summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-10-16 00:56:55 -0400
committerTony Hutter <[email protected]>2022-12-01 12:39:42 -0800
commit89c41f3979c11ee72c2129066acbbf2722036d2b (patch)
tree0292205d91e9b4e7000c6acbf7856480c83b84ec /lib
parent409c99a1d3e5c47c5b61a4d471c60c5b92c887a6 (diff)
set_global_var() should not pass NULL pointers to dlclose()
Both Coverity and Clang's static analyzer caught this. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14044
Diffstat (limited to 'lib')
-rw-r--r--lib/libzpool/util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libzpool/util.c b/lib/libzpool/util.c
index 327391245..f4e33140b 100644
--- a/lib/libzpool/util.c
+++ b/lib/libzpool/util.c
@@ -228,13 +228,14 @@ set_global_var(char const *arg)
fprintf(stderr, "Failed to open libzpool.so to set global "
"variable\n");
ret = EIO;
- goto out_dlclose;
+ goto out_free;
}
ret = 0;
out_dlclose:
dlclose(zpoolhdl);
+out_free:
free(varname);
out_ret:
return (ret);