linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jffs2: fix memory leak if the sector was successfully erased
@ 2010-02-22 16:26 Ni@m
  2010-02-22 16:33 ` Russell King - ARM Linux
  2010-02-22 16:35 ` Daniel Mack
  0 siblings, 2 replies; 5+ messages in thread
From: Ni@m @ 2010-02-22 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

Memory allocated for erase instruction is not freed if the sector was
successfully erased.

Signed-off-by: Dmytro Milinevskyy <niam.niam@gmail.com>
---
 fs/jffs2/erase.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index b47679b..c0a5604 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -74,8 +74,10 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
        ((struct erase_priv_struct *)instr->priv)->c = c;

        ret = c->mtd->erase(c->mtd, instr);
-       if (!ret)
+       if (!ret) {
+        kfree(instr);
                return;
+    }

        bad_offset = instr->fail_addr;
        kfree(instr);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-22 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 16:26 [PATCH] jffs2: fix memory leak if the sector was successfully erased Ni@m
2010-02-22 16:33 ` Russell King - ARM Linux
2010-02-22 16:35 ` Daniel Mack
2010-02-22 17:28   ` Michael Trimarchi
2010-02-22 17:40     ` niam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).