From: Kamalesh Babulal Date: Fri, 20 May 2022 14:49:37 +0000 (-0600) Subject: tools/cgsnapshot: fix coverity uninitialized variable warning X-Git-Tag: v2.0.3~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3c900fc3077224be58e0e287732c1d2b1d5591d;p=thirdparty%2Flibcgroup.git tools/cgsnapshot: fix coverity uninitialized variable warning 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 Signed-off-by: Tom Hromatka (cherry picked from commit 4a92b3ca0fcca18f69ee75d4627db7171d22d217) --- diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c index a15ab2f0..0165a469 100644 --- a/src/tools/cgsnapshot.c +++ b/src/tools/cgsnapshot.c @@ -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';