[U-Boot] [PATCH] drivers/elbc:Memory leak fix

Raghav Dogra raghav at freescale.com
Wed May 20 11:24:58 CEST 2015


Freeing allocated memory to priv before returning
from the function

Signed-off-by: Raghav Dogra <raghav at freescale.com>
---
 drivers/mtd/nand/fsl_elbc_nand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index e85832d..bbf1f39 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -679,6 +679,7 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr)
 	if (priv->bank >= MAX_BANKS) {
 		printf("fsl_elbc_nand: address did not match any "
 		       "chip selects\n");
+		kfree((void *)priv);
 		return -ENODEV;
 	}
 
-- 
1.9.1



More information about the U-Boot mailing list