aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zhack.c
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-09-23 19:55:26 -0400
committerGitHub <[email protected]>2022-09-23 16:55:26 -0700
commitebe1d0361671c80025d5be2c31131ed223115873 (patch)
tree04f6b7e5a3af21a543afe7d4afa4465908cd4a29 /cmd/zhack.c
parent2a493a4c7127258b14c39e8c71a9d6f01167c5cd (diff)
Fix userland resource leaks
Coverity caught these. With the exception of the file descriptor leak in tests/zfs-tests/cmd/draid.c, they are all memory leaks. Also, there is a piece of dead code in zfs_get_enclosure_sysfs_path(). We delete it as cleanup. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #13921
Diffstat (limited to 'cmd/zhack.c')
-rw-r--r--cmd/zhack.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd/zhack.c b/cmd/zhack.c
index 75d9c93b3..8797a53e4 100644
--- a/cmd/zhack.c
+++ b/cmd/zhack.c
@@ -295,6 +295,8 @@ zhack_do_feature_enable(int argc, char **argv)
feature.fi_flags |= ZFEATURE_FLAG_READONLY_COMPAT;
break;
case 'd':
+ if (desc != NULL)
+ free(desc);
desc = strdup(optarg);
break;
default: