]> git.proxmox.com Git - mirror_zfs.git/commitdiff
set_global_var() should not pass NULL pointers to dlclose()
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Sun, 16 Oct 2022 04:56:55 +0000 (00:56 -0400)
committerTony Hutter <hutter2@llnl.gov>
Thu, 1 Dec 2022 20:39:42 +0000 (12:39 -0800)
Both Coverity and Clang's static analyzer caught this.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14044

lib/libzpool/util.c

index 327391245a0f1b60815cef16ebbef9b4293fc545..f4e33140b6df9a1e10f05ace0da494e180f13668 100644 (file)
@@ -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);