zfs/lib/libzpool
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
..
Makefile.am Ask libtool to stop hiding some errors 2022-09-21 16:12:14 -07:00
kernel.c file reference counts can get corrupted 2021-09-14 12:37:38 -07:00
taskq.c Improve performance of zio_taskq_member 2020-03-03 10:29:38 -08:00
util.c set_global_var_parse_kv() should pass the pointer from strdup() 2022-12-01 12:39:41 -08:00