[PATCH] jffs2: memory leak in jffs2_scan_medium()
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon May 15 18:59:01 EDT 2006
Commit: 5b5ffbc1e6d62d89747f3f59c09b2e488a7d7fce
Parent: 184f565210c6c8a852c53ffc070f9add61e0f331
Author: Florin Malita <fmalita at gmail.com>
AuthorDate: Mon May 15 23:42:31 2006 +0100
Commit: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Mon May 15 23:42:31 2006 +0100
[PATCH] jffs2: memory leak in jffs2_scan_medium()
If jffs2_scan_eraseblock() fails and the exit path is taken, 's' is not
being deallocated.
Reported by Coverity, CID: 1258.
Signed-off-by: Florin Malita <fmalita at gmail.com>
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
fs/jffs2/scan.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index cf55b22..eca0996 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -222,9 +222,6 @@ #endif
}
}
- if (jffs2_sum_active() && s)
- kfree(s);
-
/* Nextblock dirty is always seen as wasted, because we cannot recycle it now */
if (c->nextblock && (c->nextblock->dirty_size)) {
c->nextblock->wasted_size += c->nextblock->dirty_size;
@@ -266,6 +263,9 @@ #ifndef __ECOS
else
c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size);
#endif
+ if (s)
+ kfree(s);
+
return ret;
}
More information about the linux-mtd-cvs
mailing list