]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgget: fix resource leak in get_cv_value()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 27 Jul 2022 18:48:19 +0000 (12:48 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 27 Jul 2022 18:48:28 +0000 (12:48 -0600)
commitd8bf0b38a75ed06520d05d130c0c92234df8665f
tree3f6e34c2d2c0b045415a2d247f918f834c91e6b8
parent397554c9df86ec7d06e017b877573859c60c258f
tools/cgget: 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/cgget.c