]> 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:40:08 +0000 (13:40 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 11 Jul 2022 19:40:15 +0000 (13:40 -0600)
commitaeded1e4176978d9705dbc5f9d9609ebf843b189
tree5f77f0884c423b0da10104f8feaf98a74cc1effb
parent6a7c4ef4f07c8593e97cdb4b0d6f5eb26d815303
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>
src/tools/cgget.c