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

Felipe W Damasio
2003-09-23T19:26:25Z

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

Hi David,

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

Please apply,

Felipe

[-- Attachment #2: mtdblock-leak.patch --]
[-- Type: text/plain, Size: 391 bytes --]

--- 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));