driver/mtd:IFC: Fix possible memory leak
authorPrabhakar Kushwaha <prabhakar@freescale.com>
Tue, 10 Apr 2012 22:48:27 +0000 (22:48 +0000)
committerScott Wood <scott@tyr.buserror.net>
Fri, 18 May 2012 23:15:24 +0000 (18:15 -0500)
if priv->bank >= MAX_BANK, priv should be freed before returning ENODEV.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Scott Wood <scott@tyr.buserror.net>
drivers/mtd/nand/fsl_ifc_nand.c

index a51852608a048740e31c2718dc89b207990beb1b..b3b7c705e189a9fdfb61ba45c517d1de1fc03bed 100644 (file)
@@ -775,6 +775,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;
        }