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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241122092830.91079-1-heminhong@kylinos.cn>
Date: Fri, 22 Nov 2024 17:28:30 +0800
From: Minhong He <heminhong@...inos.cn>
To: heminhong@...inos.cn,
	linux-kernel@...r.kernel.org
Subject: [PATCH] scripts: prevent resource leak

In the main() function, the fopen() is used to open the file.
When the file is successfully opened, not using fclose() to close the file.
It will cause memory leak or file corruption.

Signed-off-by: Minhong He <heminhong@...inos.cn>
---
 scripts/insert-sys-cert.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/insert-sys-cert.c b/scripts/insert-sys-cert.c
index 8902836c2342..dcd1902b495e 100644
--- a/scripts/insert-sys-cert.c
+++ b/scripts/insert-sys-cert.c
@@ -361,6 +361,7 @@ int main(int argc, char **argv)
 		get_symbol_from_map(hdr, system_map, USED_SYM, &used_sym);
 		get_symbol_from_map(hdr, system_map, LSIZE_SYM, &lsize_sym);
 		cert_sym.size = used_sym.address - cert_sym.address;
+		fclose(system_map);
 	} else {
 		info("Symbol table found.\n");
 		if (system_map_file)
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ