Skip to content
Permalink
Browse files

free cpu_ban_string when the next request come

  • Loading branch information
liuchao173 committed Feb 6, 2020
1 parent 4d02672 commit 0fab11043aef5b835ed5564dc15476cdbfb54d5b
Showing with 5 additions and 18 deletions.
  1. +0 −4 cputree.c
  2. +5 −14 irqbalance.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")) {
@@ -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"))) {

0 comments on commit 0fab110

Please sign in to comment.
You can’t perform that action at this time.