]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
abstraction-cpu: fix resource leak in read_setting()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 20 Jul 2022 17:06:02 +0000 (11:06 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 20 Jul 2022 17:06:06 +0000 (11:06 -0600)
commit5d0fd92106fd024fde6b56e5a5289941ab159499
tree018e636fe1ae746e4ca0fe008c42c432c31a6499
parentf2f107c8b3ef0f699c0a3f77aeebbcbeb4f1b8b1
abstraction-cpu: fix resource leak in read_setting()

Fix a resource leak, reported by Coverity tool:

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

In read_setting(), 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/abstraction-cpu.c