From: Peter Schiffer Date: Mon, 14 Oct 2013 04:48:06 +0000 (+0200) Subject: Invalid reallocation of config_table in config_insert_cgroup() X-Git-Tag: v0.41~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c012978a3b82b6c959dddd3918c65d864995aaf;p=thirdparty%2Flibcgroup.git Invalid reallocation of config_table in config_insert_cgroup() There's invalid reallocation of config_table variable in config_insert_cgroup() function. Signed-off-by: Peter Schiffer Acked-by: Ivana Hutarova Varekova --- diff --git a/src/config.c b/src/config.c index cdbd5085..ac844a7a 100644 --- a/src/config.c +++ b/src/config.c @@ -130,7 +130,7 @@ int config_insert_cgroup(char *cg_name, int flag) break; default: return 0; - } + } if (*table_index >= *max - 1) { struct cgroup *newblk; @@ -151,7 +151,17 @@ int config_insert_cgroup(char *cg_name, int flag) memset(newblk + oldlen, 0, (*max - oldlen) * sizeof(struct cgroup)); init_cgroup_table(newblk + oldlen, *max - oldlen); - config_cgroup_table = newblk; + config_table = newblk; + switch (flag) { + case CGROUP: + config_cgroup_table = config_table; + break; + case TEMPLATE: + config_template_table = config_table; + break; + default: + return 0; + } cgroup_dbg("maximum %d\n", *max); cgroup_dbg("reallocated config_table to %p\n", config_table);