2013-10-24 12:25:33

by Valentin Ilie

[permalink] [raw]
Subject: [PATCH] clk: sunxi: fix memory leaks

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

Signed-off-by: Valentin Ilie <[email protected]>
---
drivers/clk/sunxi/clk-sunxi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 34ee69f..a970b55 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -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);
--
1.8.1.2


2013-10-24 15:55:15

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH] clk: sunxi: fix memory leaks

Hi,

On Thu, Oct 24, 2013 at 03:25:13PM +0300, Valentin Ilie wrote:
> When the if condition is true, "fixed" and "gate" should be free'd before return.
>
> Signed-off-by: Valentin Ilie <[email protected]>

A patch has already been submitted for this.

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

Thanks anyway!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


Attachments:
(No filename) (427.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments