[PATCH] jffs2: fix memory leak if the sector was successfully erased

Daniel Mack daniel at caiaq.de
Mon Feb 22 11:35:43 EST 2010


On Mon, Feb 22, 2010 at 06:26:22PM +0200, Ni at m wrote:
> Memory allocated for erase instruction is not freed if the sector was
> successfully erased.
> 
> Signed-off-by: Dmytro Milinevskyy <niam.niam at gmail.com>

Can you forward that to the right people please? Call
scripts/get_maintainer.pl to get a list of maintainers.

Daniel



> ---
>  fs/jffs2/erase.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
> index b47679b..c0a5604 100644
> --- a/fs/jffs2/erase.c
> +++ b/fs/jffs2/erase.c
> @@ -74,8 +74,10 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
>         ((struct erase_priv_struct *)instr->priv)->c = c;
> 
>         ret = c->mtd->erase(c->mtd, instr);
> -       if (!ret)
> +       if (!ret) {
> +        kfree(instr);
>                 return;
> +    }
> 
>         bad_offset = instr->fail_addr;
>         kfree(instr);
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



More information about the linux-arm-kernel mailing list