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] [day] [month] [year] [list]
Message-ID: <3b7316db-42e6-488c-affb-297b33e08bf6@linuxfoundation.org>
Date: Wed, 4 Sep 2024 10:57:59 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: zhangjiao2 <zhangjiao2@...s.chinamobile.com>, tglx@...utronix.de
Cc: mingo@...hat.com, shuah@...nel.org, linux-kernel@...r.kernel.org,
 linux-kselftest@...r.kernel.org, Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] selftests: futex: Fix missing free in main

On 9/3/24 20:55, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@...s.chinamobile.com>
> 
> Free string allocated by asprintf().

How did you find this problem? Include the details in
the change log - The tool and output from the tool.

> 
> Signed-off-by: zhang jiao <zhangjiao2@...s.chinamobile.com>
> ---
>   tools/testing/selftests/futex/functional/futex_requeue_pi.c | 3 +++
>   1 file changed, 3 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..fb2dab46087f 100644
> --- a/tools/testing/selftests/futex/functional/futex_requeue_pi.c
> +++ b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
> @@ -416,5 +416,8 @@ int main(int argc, char *argv[])
>   	ret = unit_test(broadcast, locked, owner, timeout_ns);
>   
>   	print_result(test_name, ret);
> +	if (strlen(test_name) > strlen(TEST_NAME))
> +		free(test_name);

Why not set a flag to determine if test_name needs freeing
instead of calling strlen() twice?

> +
>   	return ret;
>   }

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ