The patch titled jffs2: memory leak in jffs2_scan_medium() has been added to the -mm tree. Its filename is jffs2-memory-leak-in-jffs2_scan_medium.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this From: Florin Malita <fmalita@xxxxxxxxx> If jffs2_scan_eraseblock() fails and the exit path is taken, 's' is not being deallocated. Reported by Coverity, CID: 1258. [akpm@xxxxxxxx: kzalloc() conversion] Signed-off-by: Florin Malita <fmalita@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/jffs2/scan.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff -puN fs/jffs2/scan.c~jffs2-memory-leak-in-jffs2_scan_medium fs/jffs2/scan.c --- 25/fs/jffs2/scan.c~jffs2-memory-leak-in-jffs2_scan_medium Mon May 15 15:15:48 2006 +++ 25-akpm/fs/jffs2/scan.c Mon May 15 15:17:12 2006 @@ -106,12 +106,11 @@ int jffs2_scan_medium(struct jffs2_sb_in } if (jffs2_sum_active()) { - s = kmalloc(sizeof(struct jffs2_summary), GFP_KERNEL); + s = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL); if (!s) { JFFS2_WARNING("Can't allocate memory for summary\n"); return -ENOMEM; } - memset(s, 0, sizeof(struct jffs2_summary)); } for (i=0; i<c->nr_blocks; i++) { @@ -222,9 +221,6 @@ int jffs2_scan_medium(struct jffs2_sb_in } } - 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 +262,8 @@ int jffs2_scan_medium(struct jffs2_sb_in else c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); #endif + kfree(s); + return ret; } _ Patches currently in -mm which might be from fmalita@xxxxxxxxx are jffs2-memory-leak-in-jffs2_scan_medium.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html