]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgdelete: fix coverity wrong argument size warning
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 18 May 2022 17:09:51 +0000 (11:09 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 18 May 2022 17:10:05 +0000 (11:10 -0600)
Fix a wrong argument size, reported by Coverity tool:

CID 1412122 (#1 of 1): Wrong sizeof argument (SIZEOF_MISMATCH)
suspicious_sizeof: Passing argument 8UL
/* sizeof (struct ext_cgroup_record *) */ to function calloc and then
casting the return value to struct ext_cgroup_record * is suspicious.

Also, fix the typo in the variable name, that's being allocated memory.

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

index 248939cb9590bbe749d938a66482507d66175fa8..1f3ed8ce30ec33fd3033294c29ce5846355a8d97 100644 (file)
@@ -143,8 +143,8 @@ int main(int argc, char *argv[])
                goto err;
        }
 
-       ecg_list = calloc(argc, sizeof(struct ext_cgroup_record *));
-       if (cgroup_list == NULL) {
+       ecg_list = calloc(argc, sizeof(struct ext_cgroup_record));
+       if (ecg_list == NULL) {
                err("%s: out of memory\n", argv[0]);
                ret = -1;
                goto err;