diff options
author | наб <[email protected]> | 2021-05-03 12:13:20 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-05-08 09:25:59 -0700 |
commit | c493943404c684b5686e0e782f874448253b31c5 (patch) | |
tree | 18f2e9757ad16f4ad0e02c0b1441863e3ad66089 /lib | |
parent | 8dfb9e57c7364b2fbf1a24914a9e8b78de349005 (diff) |
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 #11993
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzutil/os/linux/zutil_device_path_os.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libzutil/os/linux/zutil_device_path_os.c b/lib/libzutil/os/linux/zutil_device_path_os.c index 71134a538..2a6f4ae2a 100644 --- a/lib/libzutil/os/linux/zutil_device_path_os.c +++ b/lib/libzutil/os/linux/zutil_device_path_os.c @@ -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)); |