[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <900111.75858.qm@web43503.mail.sp1.yahoo.com>
Date: Tue, 14 Jul 2009 09:45:27 -0700 (PDT)
From: number9652 <number9652@...oo.com>
To: linux-ext4@...r.kernel.org
Subject: [PATCH] libext2fs: fix memory leak in block_iterate
One of the error paths in block_iterate could return before freeing the
scratch memory. Here we free that memory before returning.
Signed-off-by: Nic Case <number9652@...oo.com>
---
diff --git a/e2fsprogs-1.41.8-orig/lib/ext2fs/block.c b/e2fsprogs-1.41.8/lib/ext2fs/block.c
index de5342d..bb20f6e 100644
--- a/e2fsprogs-1.41.8-orig/lib/ext2fs/block.c
+++ b/e2fsprogs-1.41.8/lib/ext2fs/block.c
@@ -488,8 +488,11 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
abort_exit:
if (ret & BLOCK_CHANGED) {
retval = ext2fs_write_inode(fs, ino, &inode);
- if (retval)
+ if (retval) {
+ if (!block_buf)
+ ext2fs_free_mem(&ctx.ind_buf);
return retval;
+ }
}
errout:
if (!block_buf)
---
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists