]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api: fix coverity warning about uninitialized variable
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 27 May 2022 20:56:42 +0000 (14:56 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 27 May 2022 20:56:47 +0000 (14:56 -0600)
commit9ba6fdec08044b19bcfcbb3a71db1905dd391283
tree1b774dc4eb0c82c30b968305d0972a4cc11de40b
parentc5fe7f83c1feae890523c8d09238ff535caebd58
api: fix coverity warning about uninitialized variable

Fix Uninitialized scalar variable, reported by Coverity tool:

CID 258269 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use: Using uninitialized value version.

In _cgroup_create_cgroup(), the (cg_version_t)version is uninitialized
and might be read the version in false path. It worked until now
because the version is assigned in the true path and given that its enum
the checks are not bounded by range, but rather specific.

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