Skip to contentSkip to conversation

selftests: ALSA: fix memory leak in utimer test

PATCH Applied WangYuli 2 participants 2 messages Jul 31, 2025

Subsystems (3)
lore
Share & tools
lore

WangYuli

author
#0 lore raw

PATCH 1/1 selftests: ALSA: fix memory leak in utimer test

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

---
 tools/testing/selftests/alsa/utimer-test.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/alsa/utimer-test.c +1 -0
index 32ee3ce57721..37964f311a33 100644
@@ -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) {
Signature · 1 line
2.50.1
Applied
#1 lore raw
Quoted 6 lines · WangYuli

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

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

Takashi

Quoted 19 lines
---
 tools/testing/selftests/alsa/utimer-test.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/alsa/utimer-test.c +1 -0
index 32ee3ce57721..37964f311a33 100644
@@ -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) {
Signature · 1 line
2.50.1