]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: fix dereference after null check
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 3 Aug 2022 18:36:48 +0000 (12:36 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 3 Aug 2022 18:36:52 +0000 (12:36 -0600)
commite34ae57b9bcb736489142acf56484dd647691f11
tree3a9bb726eb88e503fcc9591e122e8702286bedfe
parent23cee33b4d2c856c1c442f7dfed1237a5e52e2a3
api.c: fix dereference after null check

Fix dereference after null check warning, reported by Coverity tool:

CID 258308 (#1 of 1): Dereference after null check (FORWARD_NULL).
var_deref_model: Passing null pointer controller to strncmp, which
dereferences it.

Fix the warning in cgroup_get_controller_version(), by checking for the
an empty controller in the case of cgroup v1.

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