diff --git a/cputree.c b/cputree.c index 9aa4794..bef1f40 100644 --- a/cputree.c +++ b/cputree.c @@ -118,10 +118,6 @@ static void setup_banned_cpus(void) if (cpu_ban_string != NULL && banned_cpumask_from_ui != NULL) { cpulist_parse(banned_cpumask_from_ui, strlen(banned_cpumask_from_ui), banned_cpus); - /* release it safety, it was allocated in sock_handle */ - free(cpu_ban_string); - cpu_ban_string = NULL; - banned_cpumask_from_ui = NULL; goto out; } if (getenv("IRQBALANCE_BANNED_CPUS")) { diff --git a/irqbalance.c b/irqbalance.c index e76d27b..9f65c88 100644 --- a/irqbalance.c +++ b/irqbalance.c @@ -471,12 +471,9 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri free(irq_string); } else if (!(strncmp(buff + strlen("settings "), "cpus ", strlen("cpus")))) { - /* - * if cpu_ban_string has not been consumed, - * just ignore this request. - */ - if (cpu_ban_string != NULL) - goto out_close; + banned_cpumask_from_ui = NULL; + free(cpu_ban_string); + cpu_ban_string = NULL; cpu_ban_string = malloc( sizeof(char) * (recv_size - strlen("settings cpus "))); @@ -489,15 +486,9 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri if (!strncmp(banned_cpumask_from_ui, "NULL", strlen("NULL"))) { banned_cpumask_from_ui = NULL; free(cpu_ban_string); - cpu_ban_string = NULL;; - } else { - /* - * don't free cpu_ban_string at here, it will be - * released after we have store it to @banned_cpus - * in setup_banned_cpus function. - */ - need_rescan = 1; + cpu_ban_string = NULL; } + need_rescan = 1; } } if (!strncmp(buff, "setup", strlen("setup"))) {