Fix uninitialized variable, reported by the Coverity tool:
CID 321266: Uninitialized scalar variable (UNINIT)
memset(), ctrl_name with every iteration, to avoid using the stale value
or uninitialized values.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
}
while (fgets(buffer, FILENAME_MAX, pid_proc_fp)) {
+ memset(ctrl_name, '\0', sizeof(CONTROL_NAMELEN_MAX));
+
/* read according to the cgroup mode */
if (strstr(buffer, "::"))
ret = sscanf(buffer, "%d::%4096s\n", &idx, cgroup_name);