From 1662a0e2171bc73bb11a69be3ccaa6a0bd2badb9 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sun, 16 Oct 2022 00:56:55 -0400 Subject: [PATCH] set_global_var() should not pass NULL pointers to dlclose() Both Coverity and Clang's static analyzer caught this. Reviewed-by: Brian Behlendorf Signed-off-by: Richard Yao Closes #14044 --- lib/libzpool/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libzpool/util.c b/lib/libzpool/util.c index a2bdfec1d173..0201d2752270 100644 --- a/lib/libzpool/util.c +++ b/lib/libzpool/util.c @@ -227,13 +227,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);