[RFC PATCH 2/4] workqueue: free the allocated memory resource when wq_numa_init failed.

From: wanghaibin
Date: Thu Jan 07 2016 - 07:41:40 EST


Before the return that wq_numa_init failed, it will be bettet to free
the numa node table to avoid the memory leaks.

Signed-off-by: wanghaibin <wanghaibin.wang@xxxxxxxxxx>
---
kernel/workqueue.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d6cbe3d..60e192c 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5195,6 +5195,10 @@ static void __init wq_numa_init(void)
for_each_possible_cpu(cpu) {
node = cpu_to_node(cpu);
if (WARN_ON(node == NUMA_NO_NODE)) {
+ for_each_node(node)
+ free_cpumask_var(tbl[node]);
+ kfree(tbl);
+
pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu);
/* happens iff arch is bonkers, let's just proceed */
return;
--
1.8.3.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/