Skip to content

Commit

Permalink
set_global_var() should not pass NULL pointers to dlclose()
Browse files Browse the repository at this point in the history
Both Coverity and Clang's static analyzer caught this.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes openzfs#14044
  • Loading branch information
ryao authored and andrewc12 committed Nov 9, 2022
1 parent 84aa84c commit 023b3d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/libzpool/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,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:
#endif
Expand Down

0 comments on commit 023b3d4

Please sign in to comment.