36 lines
944 B
Diff
36 lines
944 B
Diff
commit 699deffdd881bf4759f3fcc4d6ee3e018e4c266e
|
|
Author: Tom Li <biergaizi2009@gmail.com>
|
|
Date: Fri Apr 18 20:06:18 2014 -0400
|
|
|
|
fix memory leak in classify code
|
|
|
|
If a system has no pci devices the opening of the pci bus directory in
|
|
rebuild_irq_db will fail, leading to a memory leak. Fix it by freeing the list
|
|
we create in that function always on exit
|
|
|
|
Reported-by: Tom Li <biergaizi2009@gmail.com>
|
|
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
|
|
Signed-off-by: Tom Li <biergaizi2009@gmail.com>
|
|
|
|
diff --git a/classify.c b/classify.c
|
|
index 1867a94..94b53b8 100644
|
|
--- a/classify.c
|
|
+++ b/classify.c
|
|
@@ -465,7 +465,7 @@ void rebuild_irq_db(void)
|
|
|
|
devdir = opendir(SYSDEV_DIR);
|
|
if (!devdir)
|
|
- return;
|
|
+ goto free;
|
|
|
|
do {
|
|
entry = readdir(devdir);
|
|
@@ -482,6 +482,7 @@ void rebuild_irq_db(void)
|
|
|
|
for_each_irq(tmp_irqs, add_missing_irq, NULL);
|
|
|
|
+free:
|
|
g_list_free_full(tmp_irqs, free);
|
|
|
|
}
|