Skip to contentSkip to conversation

clk: sunxi: fix memory leaks

PATCH In review Valentin Ilie 2 participants 2 messages Oct 24, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: sunxi: fix memory leaks

When the if condition is true, "fixed" and "gate" should be free'd before return.

---
 drivers/clk/sunxi/clk-sunxi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/sunxi/clk-sunxi.c +4 -1
index 34ee69f..a970b55 100644
@@ -48,8 +48,11 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
 		return;
 	}
 
-	if (of_property_read_u32(node, "clock-frequency", &rate))
+	if (of_property_read_u32(node, "clock-frequency", &rate)) {
+		kfree(fixed);
+		kfree(gate);
 		return;
+	}
 
 	/* set up gate and fixed rate properties */
 	gate->reg = of_iomap(node, 0);
Signature · 1 line
1.8.1.2
#1 lore raw

Hi,

Quoted 3 lines · Valentin Ilie

When the if condition is true, "fixed" and "gate" should be free'd before return.

A patch has already been submitted for this.

https://lkml.org/lkml/2013/10/18/524

Thanks anyway!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131024/f86e9e0d/attachment.sig>