From 5c012978a3b82b6c959dddd3918c65d864995aaf Mon Sep 17 00:00:00 2001 From: Peter Schiffer Date: Mon, 14 Oct 2013 06:48:06 +0200 Subject: [PATCH] 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 --- src/config.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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); -- 2.47.2