Whamcloud - gitweb
LU-11233 utils: fix double-free of params fields 03/35003/2
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 18 Apr 2019 23:29:44 +0000 (17:29 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Jun 2019 02:37:36 +0000 (02:37 +0000)
commit0b86b935a16171120036260f4a0850e2e1245f46
tree26e75b8bc02b796bc04253fcf340e8de13baff46
parent70171a3ca9c3855a199af3952bfdd6514eff3eb3
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.

Lustre-change: https://review.whamcloud.com/34711
Lustre-commit: 7c7c39d84c98df3c6fe33c04c9e391529a86db53

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