lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 11 Jul 2008 16:02:06 +0530
From:	"Manish Katiyar" <mkatiyar@...il.com>
To:	linux-ext4@...r.kernel.org, "Theodore Tso" <tytso@....edu>
Subject: [PATCH] e2fsprogs : Fix memory leak in ext2fs_initialize.

In function ext2fs_initialize(), if we fail doing
ext2fs_allocate_block_bitmap() or ext2fs_allocate_inode_bitmap() we
directly goto cleanup and
don't free the memory allocated to buf. Below patch fixes it.

===========================================================

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

---
 lib/ext2fs/initialize.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 011656f..a8375d9 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -105,7 +105,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
 	int		rsv_gdt;
 	int		csum_flag;
 	int		io_flags;
-	char		*buf;
+	char		*buf = 0;
 	char		c;

 	if (!param || !param->s_blocks_count)
@@ -429,6 +429,9 @@ ipg_retry:
 	*ret_fs = fs;
 	return 0;
 cleanup:
+	if (buf) {
+	 ext2fs_free_mem(&buf);
+	}
 	ext2fs_free(fs);
 	return retval;
 }
-- 
1.5.4.3


===========================================================

-- 
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ