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:	Sun,  5 Jan 2014 01:26:40 -0500
From:	Theodore Ts'o <tytso@....edu>
To:	Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc:	Theodore Ts'o <tytso@...gle.com>, "Theodore Ts'o" <tytso@....edu>
Subject: [PATCH 1/4] libss: fix potential memory leak on realloc() failure

From: Theodore Ts'o <tytso@...gle.com>

Addresses-Coverity-ID: #295143

Signed-off-by: "Theodore Ts'o" <tytso@....edu>
---
 lib/ss/invocation.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/ss/invocation.c b/lib/ss/invocation.c
index 61c2e35..924427a 100644
--- a/lib/ss/invocation.c
+++ b/lib/ss/invocation.c
@@ -28,7 +28,7 @@ int ss_create_invocation(const char *subsystem_name, const char *version_string,
 {
 	register int sci_idx;
 	register ss_data *new_table;
-	register ss_data **table;
+	register ss_data **table, **rt;
 
 	*code_ptr = 0;
 	table = _ss_table;
@@ -42,10 +42,10 @@ int ss_create_invocation(const char *subsystem_name, const char *version_string,
 
 	for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
 		;
-	table = (ss_data **) realloc((char *)table,
-				     ((unsigned)sci_idx+2)*size);
-	if (table == NULL) {
-		*code_ptr = errno;
+	rt = (ss_data **) realloc((char *)table, ((unsigned)sci_idx+2)*size);
+	if (rt == NULL) {
+		*code_ptr = ENOMEM;
+		free(table);
 		return 0;
 	}
 	table[sci_idx+1] = (ss_data *) NULL;
-- 
1.8.5.rc3.362.gdf10213

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