All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libext2fs : Fix memory leaks in ext2fs_extent_open()
@ 2008-08-15 20:56 Manish Katiyar
  2008-08-16 14:52 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Manish Katiyar @ 2008-08-15 20:56 UTC (permalink / raw)
  To: Theodore Tso, linux-ext4; +Cc: mkatiyar

Memory allocated for the ext2_extent_handle is not getting freed from
all the return paths in case of error. Below patch fixes it.

Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>

---
 lib/ext2fs/extent.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index 44d7d9b..42a6cb9 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -222,12 +222,14 @@ extern errcode_t ext2fs_extent_open(ext2_filsys
fs, ext2_ino_t ino,
 		handle->inode->i_flags |= EXT4_EXTENTS_FL;
 	}

-	if (!(handle->inode->i_flags & EXT4_EXTENTS_FL))
-		return EXT2_ET_INODE_NOT_EXTENT;
+	if (!(handle->inode->i_flags & EXT4_EXTENTS_FL)) {
+		retval = EXT2_ET_INODE_NOT_EXTENT;
+		goto errout;
+	}

 	retval = ext2fs_extent_header_verify(eh, sizeof(handle->inode->i_block));
-	if (retval)
-		return (retval);
+	if (retval)
+		goto errout;

 	handle->max_depth = ext2fs_le16_to_cpu(eh->eh_depth);
 	handle->type = ext2fs_le16_to_cpu(eh->eh_magic);
-- 
1.5.4.3

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

* Re: [PATCH] libext2fs : Fix memory leaks in ext2fs_extent_open()
  2008-08-15 20:56 [PATCH] libext2fs : Fix memory leaks in ext2fs_extent_open() Manish Katiyar
@ 2008-08-16 14:52 ` Theodore Tso
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2008-08-16 14:52 UTC (permalink / raw)
  To: Manish Katiyar; +Cc: linux-ext4

On Sat, Aug 16, 2008 at 02:26:43AM +0530, Manish Katiyar wrote:
> Memory allocated for the ext2_extent_handle is not getting freed from
> all the return paths in case of error. Below patch fixes it.
> 
> Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>

Thanks, applied.

					- Ted

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

end of thread, other threads:[~2008-08-16 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-15 20:56 [PATCH] libext2fs : Fix memory leaks in ext2fs_extent_open() Manish Katiyar
2008-08-16 14:52 ` Theodore Tso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.