]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgxget: fix the resource leak in convert_cgroup()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 27 Jul 2022 19:01:31 +0000 (13:01 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 27 Jul 2022 19:01:35 +0000 (13:01 -0600)
commit66799b867c7ace0affa61fba70fb0fab42725499
treece3925672cf1b22c9b468fde7fe5aad64e683cfb
parent67287701aeca061f9df6c96bbf05df3dc4c5d1a9
tools/cgxget: fix the resource leak in convert_cgroup()

Fix a resource leak warning reported by the Coverity tool:

CID 258272 (#1-2 of 2): Resource leak (RESOURCE_LEAK). leaked_storage:
Variable cg_converted_list going out of scope leaks the storage it
points to.

while free'ing() the cg_converted_list() via cgroup_free(), wrong array
index variable was passed, causing the resource leak. Fix it by passing
the right index variable.

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