aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Malita <fmalita@gmail.com>2006-05-15 18:42:31 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-15 18:42:31 -0400
commit5b5ffbc1e6d62d89747f3f59c09b2e488a7d7fce (patch)
treec2330fcf5e5c2e64d4b1bf3c7dce3ed19e164af1
parent184f565210c6c8a852c53ffc070f9add61e0f331 (diff)
[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@gmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r--fs/jffs2/scan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index cf55b221fc2b..eca0996def60 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -222,9 +222,6 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
222 } 222 }
223 } 223 }
224 224
225 if (jffs2_sum_active() && s)
226 kfree(s);
227
228 /* Nextblock dirty is always seen as wasted, because we cannot recycle it now */ 225 /* Nextblock dirty is always seen as wasted, because we cannot recycle it now */
229 if (c->nextblock && (c->nextblock->dirty_size)) { 226 if (c->nextblock && (c->nextblock->dirty_size)) {
230 c->nextblock->wasted_size += c->nextblock->dirty_size; 227 c->nextblock->wasted_size += c->nextblock->dirty_size;
@@ -266,6 +263,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
266 else 263 else
267 c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); 264 c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size);
268#endif 265#endif
266 if (s)
267 kfree(s);
268
269 return ret; 269 return ret;
270} 270}
271 271