[PATCH] pxa2xx-flash.c: fix memory leak

Daniel Mack daniel at caiaq.de
Mon Mar 23 20:19:03 EDT 2009


Signed-off-by: Daniel Mack <daniel at caiaq.de>
Cc: Nicolas Pitre <nico at cam.org>
---
 drivers/mtd/maps/pxa2xx-flash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 771139c..9d66881 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -70,6 +70,7 @@ static int __init pxa2xx_flash_probe(struct device *dev)
 	if (!info->map.virt) {
 		printk(KERN_WARNING "Failed to ioremap %s\n",
 		       info->map.name);
+		kfree(info);
 		return -ENOMEM;
 	}
 	info->map.cached =
@@ -92,6 +93,7 @@ static int __init pxa2xx_flash_probe(struct device *dev)
 		iounmap((void *)info->map.virt);
 		if (info->map.cached)
 			iounmap(info->map.cached);
+		kfree(info);
 		return -EIO;
 	}
 	info->mtd->owner = THIS_MODULE;
-- 
1.6.2




More information about the linux-mtd mailing list