jffs2: memory leak in jffs2_scan_medium()
PATCH 1/1 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 <[email protected]>
---
fs/jffs2/scan.c +2 -3
@@ -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,8 @@ #ifndef __ECOS else c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size);#endif +kfree (s); +return ret; }
David Woodhouse
maintainerQuoted 7 lines · Florin Malita
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 <[email protected]>
Applied with minor modifications and no trailing whitespace; thanks.
Signature · 1 line
dwmw2