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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1316206180-6375-26-git-send-email-sandeen@redhat.com>
Date:	Fri, 16 Sep 2011 15:49:40 -0500
From:	Eric Sandeen <sandeen@...hat.com>
To:	linux-ext4@...r.kernel.org
Cc:	Eric Sandeen <sandeen@...hat.com>
Subject: [PATCH 25/25] mke2fs: free tdb_dir string if it came from the profile

if tdb_dir points to a string allocated from profile_get_string,
it should be freed again before we exit.

Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---
 misc/mke2fs.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index e30c070..3076830 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2024,18 +2024,21 @@ open_err_out:
 static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr)
 {
 	errcode_t retval = ENOMEM;
-	char *tdb_dir, *tdb_file = NULL;
+	char *tdb_dir = NULL, *tdb_file = NULL;
 	char *device_name, *tmp_name;
+	int free_tdb_dir = 0;
 
 	/*
 	 * Configuration via a conf file would be
 	 * nice
 	 */
 	tdb_dir = getenv("E2FSPROGS_UNDO_DIR");
-	if (!tdb_dir)
+	if (!tdb_dir) {
 		profile_get_string(profile, "defaults",
 				   "undo_dir", 0, "/var/lib/e2fsprogs",
 				   &tdb_dir);
+		free_tdb_dir = 1;
+	}
 
 	if (!strcmp(tdb_dir, "none") || (tdb_dir[0] == 0) ||
 	    access(tdb_dir, W_OK))
@@ -2069,10 +2072,14 @@ static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr)
 		 "using the command:\n"
 		 "    e2undo %s %s\n\n"), tdb_file, name);
 
+	if (free_tdb_dir)
+		free(tdb_dir);
 	free(tdb_file);
 	return 0;
 
 errout:
+	if (free_tdb_dir)
+		free(tdb_dir);
 	free(tdb_file);
 	com_err(program_name, retval,
 		_("while trying to setup undo file\n"));
-- 
1.7.4.1

--
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