zfs/lib/libzpool
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
..
Makefile.am Cleanup dead spa_boot code 2022-09-13 16:40:10 -07:00
kernel.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
taskq.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
util.c set_global_var_parse_kv() should pass the pointer from strdup() 2022-09-23 10:51:14 -07:00