mtd: fsl_upm: fix a memory leak in fun_chip_init error path

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:25 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=a751d3155dee38cb2a8e46d8cf3fa6998b2f3239
Commit:     a751d3155dee38cb2a8e46d8cf3fa6998b2f3239
Parent:     201ab536ac205a2787f8eac2eedc697616f99e04
Author:     Axel Lin <axel.lin at gmail.com>
AuthorDate: Thu Jun 30 19:53:09 2011 +0800
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 15:02:14 2011 +0300

    mtd: fsl_upm: fix a memory leak in fun_chip_init error path
    
    Signed-off-by: Axel Lin <axel.lin at gmail.com>
    Signed-off-by: Artem Bityutskiy <dedekind1 at gmail.com>
---
 drivers/mtd/nand/fsl_upm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index da92fed..b4f3cc9 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -196,6 +196,8 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun,
 	ret = mtd_device_parse_register(&fun->mtd, NULL, &ppdata, NULL, 0);
 err:
 	of_node_put(flash_np);
+	if (ret)
+		kfree(fun->mtd.name);
 	return ret;
 }
 



More information about the linux-mtd-cvs mailing list