Messages in this thread Patch in this message | | | Date | Tue, 23 Sep 2003 16:25:01 -0300 | From | Felipe W Damasio <> | Subject | [PATCH] Memory leak in mtd/chips/cfi_cmdset_0020.c |
| |
Hi Andrew,
Patch against 2.6-test5.
If other kmallocs failed after successfully allocating a "struct mtd_info", it should be freed before returning NULL.
This function is called by inter_module_register...so I'm not sure it should really be freed...please review :)
Don't have the hardware, so just compilation checked.
Found by the Stanford Checker.
Thanks,
Felipe --- linux-2.6.0-test5/drivers/mtd/chips/cfi_cmdset_0020.c.orig 2003-09-23 16:15:35.000000000 -0300 +++ linux-2.6.0-test5/drivers/mtd/chips/cfi_cmdset_0020.c 2003-09-23 16:18:48.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; } @@ -232,6 +233,7 @@ printk(KERN_WARNING "Sum of regions (%lx) != total size of set of interleaved chips (%lx)\n", offset, devsize); kfree(mtd->eraseregions); kfree(cfi->cmdset_priv); + kfree(mtd); return NULL; } | |