From: Ivana Varekova Date: Thu, 21 May 2009 10:05:42 +0000 (+0200) Subject: parse_cgroup_spec function does not initializesd allocated memory X-Git-Tag: v0.34~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c1a7d9e05a1ffa0740b6db1a85f55d54c761d1e;p=thirdparty%2Flibcgroup.git parse_cgroup_spec function does not initializesd allocated memory parse_cgroup_spec function does not initializesd allocated memory this patch allocate it to zero so there is no problem with uninitialized values. Signed-off-by: Ivana Varekova Signed-off-by: Dhaval Giani --- diff --git a/src/tools/tools-common.c b/src/tools/tools-common.c index 0bb666f5..b80ae3ca 100644 --- a/src/tools/tools-common.c +++ b/src/tools/tools-common.c @@ -56,7 +56,7 @@ int parse_cgroup_spec(struct cgroup_group_spec *cdptr[], char *optarg) return -1; /* instanciate cgroup_data. */ - cdptr[i] = malloc(sizeof(struct cgroup_group_spec)); + cdptr[i] = calloc(1, sizeof(struct cgroup_group_spec)); if (!cdptr[i]) { fprintf(stderr, "%s\n", strerror(errno)); return -1;