Commit c4939434 authored by наб's avatar наб Committed by Brian Behlendorf
Browse files

zfs_get_enclosure_sysfs_path(): don't free undefined pointer


Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: default avatarAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11993
parent 8dfb9e57
......@@ -207,9 +207,10 @@ zfs_get_enclosure_sysfs_path(const char *dev_name)
if (strstr(ep->d_name, "enclosure_device") == NULL)
continue;
if (asprintf(&tmp2, "%s/%s", tmp1, ep->d_name) == -1 ||
tmp2 == NULL)
if (asprintf(&tmp2, "%s/%s", tmp1, ep->d_name) == -1) {
tmp2 = NULL;
break;
}
size = readlink(tmp2, buf, sizeof (buf));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment