freebsd-dev/lib
Richard Yao d25153d555
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-09-23 10:51:14 -07:00
..
libavl cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libefi Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libicp Introduce BLAKE3 checksums as an OpenZFS feature 2022-06-08 15:55:57 -07:00
libnvpair Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libshare Fix unable to export zpool without nfs-utils 2022-09-16 13:43:26 -07:00
libspl Add membar_sync 2022-09-20 15:32:44 -07:00
libtpool Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libunicode cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libuutil Cleanup: Remove unused uu_pname code 2022-09-19 17:33:52 -07:00
libzfs Call va_end() before return in zpool_standard_error_fmt() 2022-09-20 15:20:56 -07:00
libzfs_core Implement a new type of zfs receive: corrective receive (-c) 2022-07-28 15:52:46 -07:00
libzfsbootenv Replace EXTRA_DIST with dist_noinst_DATA 2022-05-26 09:24:50 -07:00
libzpool set_global_var_parse_kv() should pass the pointer from strdup() 2022-09-23 10:51:14 -07:00
libzstd cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libzutil Remove incorrect free() in zfs_get_pci_slots_sys_path() 2022-09-13 17:00:53 -07:00
Makefile.am autoconf: use include directives instead of recursing down lib 2022-05-10 10:18:11 -07:00