[PATCH] memory leak in mtdblock.c found by checker

From: Felipe W Damasio
Date: Tue Sep 23 2003 - 14:33:37 EST


Hi David,

Patch against 2.6-test5, which checks the right variable if kmalloc failed.

Please apply,

Felipe --- linux-2.6.0-test5/drivers/mtd/mtdblock.c.orig 2003-09-23 16:09:37.000000000 -0300
+++ linux-2.6.0-test5/drivers/mtd/mtdblock.c 2003-09-23 16:10:50.000000000 -0300
@@ -275,7 +275,7 @@

/* OK, it's not open. Create cache info for it */
mtdblk = kmalloc(sizeof(struct mtdblk_dev), GFP_KERNEL);
- if (!mtdblks)
+ if (!mtdblk)
return -ENOMEM;

memset(mtdblk, 0, sizeof(*mtdblk));