From: Kamalesh Babulal Date: Wed, 18 May 2022 17:09:51 +0000 (-0600) Subject: tools/cgdelete: fix coverity wrong argument size warning X-Git-Tag: v3.0~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2045fcd6b3428f1b1ca226974259e00399049472;p=thirdparty%2Flibcgroup.git tools/cgdelete: fix coverity wrong argument size warning 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 Signed-off-by: Tom Hromatka --- diff --git a/src/tools/cgdelete.c b/src/tools/cgdelete.c index 248939cb..1f3ed8ce 100644 --- a/src/tools/cgdelete.c +++ b/src/tools/cgdelete.c @@ -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;