]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgxget: de-allocate cg_convert_list[] in convert_cgroup()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 4 Aug 2022 18:56:00 +0000 (12:56 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 4 Aug 2022 18:56:09 +0000 (12:56 -0600)
The commit 66799b867c7 (tools/cgxget: fix the resource leak in
convert_cgroup()), is a partial fix. It de-allocated the array members
of the dynamically allocated cg_converted_list[], but fails to free()
the cg_converted_list.  Fix the resource leak by de-allocating it.

Fixes: 66799b867c7 (tools/cgxget: fix the resource leak in convert_group)
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgxget.c

index 96fe79b4d915517a1fd29c321c3e3cc581be6b66..0d7da5b8efd6d4d17fc65ea064b94856280a6fcb 100644 (file)
@@ -770,6 +770,7 @@ out:
                /* The conversion failed */
                for (j = 0; j < i; j++)
                        cgroup_free(&(cg_converted_list[j]));
+               free(cg_converted_list);
        } else {
                /*
                 * The conversion succeeded or was unmappable.