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

login
register
mail settings
Submitter Axel Lin
Date June 30, 2011, 11:53 a.m.
Message ID <1309434789.3256.1.camel@phoenix>
Download mbox | patch
Permalink /patch/102746/
State Accepted
Commit a751d3155dee38cb2a8e46d8cf3fa6998b2f3239
Headers show

Comments

Axel Lin - June 30, 2011, 11:53 a.m.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mtd/nand/fsl_upm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

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;
 }