Plug several memory leaks as reported by valgrind
This fixes all discovered memleaks when run using the following: G_SLICE=always-malloc valgrind --suppressions=valgrind.supp --leak-check=full --show-possibly-lost=yes --show-reachable=yes ./irqbalance --debug --oneshot Note that oneshot mode is fixed; there are still several leaks present in the normal daemon mode that will be addressed in a future patch. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
875fdbb62d
commit
844d52930e
8
numa.c
8
numa.c
|
@ -37,7 +37,7 @@
|
|||
|
||||
GList *numa_nodes = NULL;
|
||||
|
||||
struct topo_obj unspecified_node = {
|
||||
static struct topo_obj unspecified_node = {
|
||||
.load = 0,
|
||||
.number = -1,
|
||||
.obj_type = OBJ_TYPE_NODE,
|
||||
|
@ -72,6 +72,7 @@ static void add_one_node(const char *nodename)
|
|||
free(cpustr);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
new->obj_type = OBJ_TYPE_NODE;
|
||||
new->number = strtoul(&nodename[4], NULL, 10);
|
||||
new->obj_type_list = &numa_nodes;
|
||||
|
@ -99,13 +100,16 @@ void build_numa_node_list(void)
|
|||
add_one_node(entry->d_name);
|
||||
}
|
||||
} while (entry);
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
static void free_numa_node(gpointer data)
|
||||
{
|
||||
if (data == (void *)(&unspecified_node))
|
||||
struct topo_obj *obj = data;
|
||||
if (data == &unspecified_node)
|
||||
return;
|
||||
|
||||
g_list_free(obj->children);
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,12 +205,12 @@ void parse_proc_stat(void)
|
|||
syslog(LOG_WARNING, "WARNING read /proc/stat. balancing is broken\n");
|
||||
fclose(file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cpucount = 0;
|
||||
while (!feof(file)) {
|
||||
if (getline(&line, &size, file)==0)
|
||||
break;
|
||||
break;
|
||||
|
||||
if (!strstr(line, "cpu"))
|
||||
break;
|
||||
|
@ -246,6 +246,7 @@ void parse_proc_stat(void)
|
|||
}
|
||||
|
||||
fclose(file);
|
||||
free(line);
|
||||
if (cpucount != get_cpu_count()) {
|
||||
syslog(LOG_WARNING, "WARNING, didn't collect load info for all cpus, balancing is broken\n");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue