zfs/lib
Richard Yao e11c4327f1 set_global_var_parse_kv() should pass the pointer from strdup()
A comment says that the caller should free k_out, but the pointer passed
via k_out is not the same pointer we received from strdup(). Instead,
it is a pointer into the region we received from strdup(). The free
function should always be called with the original pointer, so this is
likely a bug.

We solve this by calling `strdup()` a second time and then freeing the
original pointer.

Coverity reported this as a memory leak.

Reviewed-by: Neal Gompa <ngompa@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13867
2022-12-01 12:39:41 -08:00
..
libavl Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libefi Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libicp Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libnvpair Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libshare Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libspl Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libtpool Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libunicode Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libuutil Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libzfs Call va_end() before return in zpool_standard_error_fmt() 2022-12-01 12:39:41 -08:00
libzfs_core Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libzfsbootenv Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libzpool set_global_var_parse_kv() should pass the pointer from strdup() 2022-12-01 12:39:41 -08:00
libzstd Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
libzutil Remove incorrect free() in zfs_get_pci_slots_sys_path() 2022-12-01 12:39:40 -08:00
Makefile.am cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00