lkml.org 
[lkml]   [2014]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] clk: st: Fix memory leak
Date
Quoting Valentin Ilie (2014-04-22 06:15:54)
> When it fails to allocate div, gate should be free'd before return
>
> Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>

Taken into clk-fixes.

Regards,
Mike

> ---
> drivers/clk/st/clkgen-pll.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
> index bca0a0b..a886702 100644
> --- a/drivers/clk/st/clkgen-pll.c
> +++ b/drivers/clk/st/clkgen-pll.c
> @@ -521,8 +521,10 @@ static struct clk * __init clkgen_odf_register(const char *parent_name,
> gate->lock = odf_lock;
>
> div = kzalloc(sizeof(*div), GFP_KERNEL);
> - if (!div)
> + if (!div) {
> + kfree(gate);
> return ERR_PTR(-ENOMEM);
> + }
>
> div->flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO;
> div->reg = reg + pll_data->odf[odf].offset;
> --
> 1.8.3.2
>


\
 
 \ /
  Last update: 2014-05-24 01:01    [W:0.060 / U:1.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site