linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: ALSA: fix memory leak in utimer test
@ 2025-07-31 10:02 WangYuli
  2025-07-31 15:02 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: WangYuli @ 2025-07-31 10:02 UTC (permalink / raw)
  To: broonie, perex, tiwai, shuah
  Cc: linux-sound, linux-kselftest, linux-kernel, niecheng1, guanwentao,
	WangYuli, Jun Zhan

Free the malloc'd buffer in TEST_F(timer_f, utimer) to prevent
memory leak.

Reported-by: Jun Zhan <zhanjun@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 tools/testing/selftests/alsa/utimer-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/alsa/utimer-test.c b/tools/testing/selftests/alsa/utimer-test.c
index 32ee3ce57721..37964f311a33 100644
--- a/tools/testing/selftests/alsa/utimer-test.c
+++ b/tools/testing/selftests/alsa/utimer-test.c
@@ -135,6 +135,7 @@ TEST_F(timer_f, utimer) {
 	pthread_join(ticking_thread, NULL);
 	ASSERT_EQ(total_ticks, TICKS_COUNT);
 	pclose(rfp);
+	free(buf);
 }
 
 TEST(wrong_timers_test) {
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests: ALSA: fix memory leak in utimer test
  2025-07-31 10:02 [PATCH] selftests: ALSA: fix memory leak in utimer test WangYuli
@ 2025-07-31 15:02 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-07-31 15:02 UTC (permalink / raw)
  To: WangYuli
  Cc: broonie, perex, tiwai, shuah, linux-sound, linux-kselftest,
	linux-kernel, niecheng1, guanwentao, Jun Zhan

On Thu, 31 Jul 2025 12:02:22 +0200,
WangYuli wrote:
> 
> Free the malloc'd buffer in TEST_F(timer_f, utimer) to prevent
> memory leak.
> 
> Reported-by: Jun Zhan <zhanjun@uniontech.com>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>

Thanks, applied now.  I added Fixes tag in my side.


Takashi

> ---
>  tools/testing/selftests/alsa/utimer-test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/alsa/utimer-test.c b/tools/testing/selftests/alsa/utimer-test.c
> index 32ee3ce57721..37964f311a33 100644
> --- a/tools/testing/selftests/alsa/utimer-test.c
> +++ b/tools/testing/selftests/alsa/utimer-test.c
> @@ -135,6 +135,7 @@ TEST_F(timer_f, utimer) {
>  	pthread_join(ticking_thread, NULL);
>  	ASSERT_EQ(total_ticks, TICKS_COUNT);
>  	pclose(rfp);
> +	free(buf);
>  }
>  
>  TEST(wrong_timers_test) {
> -- 
> 2.50.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-31 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 10:02 [PATCH] selftests: ALSA: fix memory leak in utimer test WangYuli
2025-07-31 15:02 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).