Skip to content

Commit 3f44dfc

Browse files
ryaosnajpa
authored andcommitted
set_global_var() should not pass NULL pointers to dlclose()
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 openzfs#14044
1 parent 7bcaf45 commit 3f44dfc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/libzpool/util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,14 @@ set_global_var(char const *arg)
227227
fprintf(stderr, "Failed to open libzpool.so to set global "
228228
"variable\n");
229229
ret = EIO;
230-
goto out_dlclose;
230+
goto out_free;
231231
}
232232

233233
ret = 0;
234234

235235
out_dlclose:
236236
dlclose(zpoolhdl);
237+
out_free:
237238
free(varname);
238239
out_ret:
239240
return (ret);

0 commit comments

Comments
 (0)