]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgxget: fix resource leak in get_cv_value()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 27 Jul 2022 18:55:20 +0000 (12:55 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 27 Jul 2022 18:55:24 +0000 (12:55 -0600)
commit67287701aeca061f9df6c96bbf05df3dc4c5d1a9
tree477385bcaab68e5377771a8d3e9a3315307303f0
parentd8bf0b38a75ed06520d05d130c0c92234df8665f
tools/cgxget: fix resource leak in get_cv_value()

Fix a resource leak, reported by the Coverity tool:

CID 258291 (#1 of 1): Resource leak (RESOURCE_LEAK)8. leaked_storage:
Variable handle going out of scope leaks the storage it points to.

In get_cv_value(), currently, we goto end label, on the failure of
strdup() before closing the handle, leaking the resource. Fix it by
removing the goto, that allows the code flow to close the handle and
execute the code under the end label.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgxget.c