]> 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:44:58 +0000 (08:44 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 20 May 2022 14:45:02 +0000 (08:45 -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>
src/tools/cgsnapshot.c

index 10f9b616cd4d4ad8b1670704a7e84c4cc4f89690..a5dc3a12cfa597b6eb96ea04709cf514d9ea7b46 100644 (file)
@@ -542,7 +542,7 @@ static int is_ctlr_on_list(char controllers[CG_CONTROLLER_MAX][FILENAME_MAX],
 static int parse_controllers(cont_name_t cont_names[CG_CONTROLLER_MAX],
                             const char *program_name)
 {
-       char controllers[CG_CONTROLLER_MAX][FILENAME_MAX];
+       char controllers[CG_CONTROLLER_MAX][FILENAME_MAX] = {"\0"};
        struct cgroup_mount_point controller;
        char path[FILENAME_MAX];
        void *handle;