From: Felipe W Damasio <felipewd@terra.com.br>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Memory leak in mtd/chips/cfi_cmdset_0020.c
Date: Tue, 23 Sep 2003 16:25:01 -0300 [thread overview]
Message-ID: <3F709E0D.7090307@terra.com.br> (raw)
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
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
[-- Attachment #2: cfi-0020-leak.patch --]
[-- Type: text/plain, Size: 620 bytes --]
--- 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;
}
next reply other threads:[~2003-09-23 19:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-23 19:25 Felipe W Damasio [this message]
2003-09-23 20:34 ` Andrew Morton
2003-09-23 20:37 ` Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F709E0D.7090307@terra.com.br \
--to=felipewd@terra.com.br \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®