]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgset: fix Uninitialized pointers read
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 17 Feb 2023 09:54:50 +0000 (09:54 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 17 Feb 2023 15:06:11 +0000 (08:06 -0700)
commit4611135a0672ba2bb2b275cd71e57873da4ec293
treedbbcdaf0ba5fe22fc132960bec531b0f0e03fd2b
parent0b4016adcb47ee4dd5f478389281e84386527d89
tools/cgset: fix Uninitialized pointers read

Fix Uninitialized pointer read, reported by Coverity Tool:

CID 307778 (#2 of 2): Uninitialized pointer read (UNINIT)22.
uninit_use_in_call: Using uninitialized value src_cgroup when calling
cgroup_free.

In main(), src_cgrp points to a valid struct cgroup only when the user
calls cgset using --copy-from flag, Coverity warns about the freeing
src_cgrp, which is uninitialized in the error path.  This patch
initializes src_cgrp and cgroup uninitialized pointers and checks
is src_cgrp is valid pointer before passing it to cgroup_free()

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