[PATCH] Memory leak in mtd/chips/cfi_cmdset_0020

From: Felipe W Damasio
Date: Mon Oct 06 2003 - 09:43:20 EST


Hi David,

Patch against 2.6.0-test6.

- Frees a previous allocated kmalloced variable before returning NULL;

Found by smatch.

Please consider applying,

Felipe --- linux-2.6.0-test6/drivers/mtd/chips/cfi_cmdset_0020.c.orig 2003-10-06 11:37:31.000000000 -0300
+++ linux-2.6.0-test6/drivers/mtd/chips/cfi_cmdset_0020.c 2003-10-06 11:37:50.000000000 -0300
@@ -208,6 +208,7 @@
if (!mtd->eraseregions) {
printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
kfree(cfi->cmdset_priv);
+ kfree(mtd);
return NULL;
}