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]
Message-Id: <20240906021918.3125-1-zhangjiao2@cmss.chinamobile.com>
Date: Fri,  6 Sep 2024 10:19:18 +0800
From: zhangjiao2 <zhangjiao2@...s.chinamobile.com>
To: skhan@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	mingo@...hat.com,
	shuah@...nel.org,
	tglx@...utronix.de,
	zhang jiao <zhangjiao2@...s.chinamobile.com>
Subject: [PATCH v3] selftests: futex: Fix missing free in main

From: zhang jiao <zhangjiao2@...s.chinamobile.com>

By readind the code, I found there is no free() after asprintf().
Just free it.

Signed-off-by: zhang jiao <zhangjiao2@...s.chinamobile.com>
---
v2->v3:
	Use a bool flag to determine if test_name needs free.

 tools/testing/selftests/futex/functional/futex_requeue_pi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi.c b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
index 215c6cb539b4..a103c69c0a3b 100644
--- a/tools/testing/selftests/futex/functional/futex_requeue_pi.c
+++ b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <string.h>
+#include <stdbool.h>
 #include "atomic.h"
 #include "futextest.h"
 #include "logging.h"
@@ -362,6 +363,7 @@ int main(int argc, char *argv[])
 {
 	char *test_name;
 	int c, ret;
+	bool is_static = false;
 
 	while ((c = getopt(argc, argv, "bchlot:v:")) != -1) {
 		switch (c) {
@@ -404,6 +406,7 @@ int main(int argc, char *argv[])
 		       "%s broadcast=%d locked=%d owner=%d timeout=%ldns",
 		       TEST_NAME, broadcast, locked, owner, timeout_ns);
 	if (ret < 0) {
+		is_static = true;
 		ksft_print_msg("Failed to generate test name\n");
 		test_name = TEST_NAME;
 	}
@@ -416,5 +419,7 @@ int main(int argc, char *argv[])
 	ret = unit_test(broadcast, locked, owner, timeout_ns);
 
 	print_result(test_name, ret);
+	if (!is_static)
+		free(test_name);
 	return ret;
 }
-- 
2.33.0




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ