linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libext2fs: fix memory leak in block_iterate
@ 2009-07-14 16:45 number9652
  2009-07-18 14:09 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: number9652 @ 2009-07-14 16:45 UTC (permalink / raw)
  To: linux-ext4


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@yahoo.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)
---


      


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-18 14:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 16:45 [PATCH] libext2fs: fix memory leak in block_iterate number9652
2009-07-18 14:09 ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).