[U-Boot] [PATCH] driver/mtd:IFC: Fix possible memory leak

Prabhakar Kushwaha prabhakar at freescale.com
Wed Apr 11 10:48:27 CEST 2012


if priv->bank >= MAX_BANK, priv should be freed before returning ENODEV.

Signed-off-by: Prabhakar Kushwaha <prabhakar at freescale.com>
---
 Based upon git://git.denx.de/u-boot.git branch master

 drivers/mtd/nand/fsl_ifc_nand.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 7ff231b..5767a3e 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -764,6 +764,7 @@ int board_nand_init(struct nand_chip *nand)
 	if (priv->bank >= MAX_BANKS) {
 		printf("%s: address did not match any "
 		       "chip selects\n", __func__);
+		kfree(priv);
 		return -ENODEV;
 	}
 
-- 
1.7.5.4





More information about the U-Boot mailing list