Skip to content

Commit 130fc7c

Browse files
nabijaczlewelitonyhutter
authored andcommitted
zfs_get_enclosure_sysfs_path(): don't free undefined pointer
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11993
1 parent 5b1aab2 commit 130fc7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/libzutil/os/linux/zutil_device_path_os.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,10 @@ zfs_get_enclosure_sysfs_path(const char *dev_name)
207207
if (strstr(ep->d_name, "enclosure_device") == NULL)
208208
continue;
209209

210-
if (asprintf(&tmp2, "%s/%s", tmp1, ep->d_name) == -1 ||
211-
tmp2 == NULL)
210+
if (asprintf(&tmp2, "%s/%s", tmp1, ep->d_name) == -1) {
211+
tmp2 = NULL;
212212
break;
213+
}
213214

214215
size = readlink(tmp2, buf, sizeof (buf));
215216

0 commit comments

Comments
 (0)