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>] [day] [month] [year] [list]
Message-Id: <20240323070653.611102-1-lumingyindetect@163.com>
Date: Sat, 23 Mar 2024 15:06:53 +0800
From: LuMingYin <lumingyindetect@....com>
To: linux-kernel@...r.kernel.org
Cc: peterz@...radead.org,
	jpoimboe@...nel.org,
	LuMingYin <lumingyindetect@....com>
Subject: [PATCH] tools:Fix a memory leak related to new_alt_group

In the function 'handle_group_alt' defined in the file /linux/tools/objtool/check.c, a pointer variable named 'new_alt_group' is declared (line 1748 of the file). At line 1791 of the file, the 'malloc' function is used to allocate a block of dynamic memory for this pointer. When the if statement at line 1792 returns false, it indicates successful allocation of dynamic memory. However, when the if statement at line 1806 returns false, the program returns at line 1808. During this process, the dynamic memory area pointed to by 'new_alt_group' is neither used nor deallocated, leading to a memory leak bug. This commit fixes this issue.

Signed-off-by: LuMingYin <lumingyindetect@....com>
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index eb7e12ebc1d0..f5d8aa79e0cc 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1805,6 +1805,7 @@ static int handle_group_alt(struct objtool_file *file,
 		nop = malloc(sizeof(*nop));
 		if (!nop) {
 			WARN("malloc failed");
+			free(new_alt_group);
 			return -1;
 		}
 		memset(nop, 0, sizeof(*nop));
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ