Whamcloud - gitweb
LU-11233 utils: fix double-free of params fields 11/34711/2
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 18 Apr 2019 23:29:44 +0000 (17:29 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 May 2019 05:57:50 +0000 (05:57 +0000)
commit7c7c39d84c98df3c6fe33c04c9e391529a86db53
treebd2cc524c26b1d475e9ccaef3bf50fe6bbf56850
parentfafb93b96179d5fd2c9bc83b19e512180a4f833e
LU-11233 utils: fix double-free of params fields

Call find_param_fini() on error so that the params are not leaked
during initialization if there is an intermediate error.

Zero out the parameters as they are freed, so if find_param_fini()
is called multiple times (as it is in some error paths) it does
not corrupt the heap by double freeing pointers.  This can be hit
by calling "lfs getstripe -m" on multiple pathnames, some of which
do not exist.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ie0d7e9ee134deb0633af2f8052b8a458333ebbe5
Reviewed-on: https://review.whamcloud.com/34711
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh
lustre/utils/liblustreapi.c