]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgget: fix a resource leak get_cv_value()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Mon, 11 Jul 2022 19:41:16 +0000 (13:41 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 11 Jul 2022 19:41:20 +0000 (13:41 -0600)
commit80452cd88bfa6118df20b81b90a98d3d46dd0190
tree52a6822e1ad04cb970b42276b2ab9bd8d82a56eb
parent71eb00ef127d4e626699ee4a27a0a14c7d5145ff
tools/cgget: fix a resource leak get_cv_value()

Fix a resource leak in get_cv_value(), reported by Coverity tool:

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

failure on the realloc(), doesn't free the *handle. Fix it by using
the goto read_end(), that does the job of freeing the handle.

Suggested-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit aeded1e4176978d9705dbc5f9d9609ebf843b189)
src/tools/cgget.c