]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgsnapshot: fix coverity uninitialized variable warning
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 20 May 2022 14:49:37 +0000 (08:49 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 20 May 2022 14:49:39 +0000 (08:49 -0600)
Fix uninitialized scalar variable, reported by Coverity tool:

CID 1412125 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use_in_call: Using uninitialized element of array *controllers
when calling is_ctlr_on_list.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 4a92b3ca0fcca18f69ee75d4627db7171d22d217)

src/tools/cgsnapshot.c

index a15ab2f0f076888190e918a625d36900683ba064..0165a469f4bd0be936007f1ea782411978be584e 100644 (file)
@@ -544,7 +544,7 @@ static int parse_controllers(cont_name_t cont_names[CG_CONTROLLER_MAX],
        char path[FILENAME_MAX];
        struct cgroup_mount_point controller;
 
-       char controllers[CG_CONTROLLER_MAX][FILENAME_MAX];
+       char controllers[CG_CONTROLLER_MAX][FILENAME_MAX] = {"\0"};
        int max = 0;
 
        path[0] = '\0';