[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1358183892-28928-1-git-send-email-dinggnu@gmail.com>
Date: Mon, 14 Jan 2013 17:18:07 +0000
From: Cong Ding <dinggnu@...il.com>
To: Gregory CLEMENT <gregory.clement@...e-electrons.com>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
linux-kernel@...r.kernel.org
Cc: Cong Ding <dinggnu@...il.com>
Subject: [PATCH] clk: mvebu/clk-cpu.c: fix memory leakage
the variable cpuclk and clk_name should be properly freed.
Signed-off-by: Cong Ding <dinggnu@...il.com>
---
drivers/clk/mvebu/clk-cpu.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
index ff004578..1a0d84f 100644
--- a/drivers/clk/mvebu/clk-cpu.c
+++ b/drivers/clk/mvebu/clk-cpu.c
@@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node)
clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
if (WARN_ON(!clks))
- return;
+ goto clks_out;
for_each_node_by_type(dn, "cpu") {
struct clk_init_data init;
@@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node)
int cpu, err;
if (WARN_ON(!clk_name))
- return;
+ goto clk_name_out;
err = of_property_read_u32(dn, "reg", &cpu);
if (WARN_ON(err))
- return;
+ goto bail_out;
sprintf(clk_name, "cpu%d", cpu);
parent_clk = of_clk_get(node, 0);
@@ -166,7 +166,10 @@ void __init of_cpu_clk_setup(struct device_node *node)
return;
bail_out:
+ kfree(clk_name);
+clk_name_out:
kfree(clks);
+clks_out:
kfree(cpuclk);
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists