Skip to content

Commit

Permalink
[PATCH] jffs2: memory leak in jffs2_scan_medium()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florin Malita authored and David Woodhouse committed May 15, 2006
1 parent 184f565 commit 5b5ffbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/jffs2/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
}
}

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;
Expand Down Expand Up @@ -266,6 +263,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
else
c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size);
#endif
if (s)
kfree(s);

return ret;
}

Expand Down

0 comments on commit 5b5ffbc

Please sign in to comment.