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 snajpa committed Oct 22, 2022
1 parent 2232d08 commit 1662a0e
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 @@ -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);
Expand Down

0 comments on commit 1662a0e

Please sign in to comment.