Skip to contentSkip to conversation

pxa2xx-flash.c: fix memory leak

PATCH In review Daniel Mack 2 participants 4 messages Mar 24, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pxa2xx-flash.c: fix memory leak

---
 drivers/mtd/maps/pxa2xx-flash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mtd/maps/pxa2xx-flash.c +2 -0
index 771139c..9d66881 100644
@@ -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;
Signature · 1 line
1.6.2
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Daniel Mack
Quoted 27 lines
---
 drivers/mtd/maps/pxa2xx-flash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mtd/maps/pxa2xx-flash.c +2 -0
index 771139c..9d66881 100644
@@ -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;
Signature · 1 line
1.6.2