From e55e556f327f2a4cd40be2c76012570be2922985 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 17 Oct 2023 23:27:07 -0400
Subject: [PATCH] alsa: Fixed minor memory leak.
The default device handles aren't free'd anywhere, so don't strdup them;
everything else is managed by the hotplug thread, which does its own freeing.
---
src/audio/alsa/SDL_alsa_audio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 0826c551b6ec..c6f86d846020 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -910,10 +910,10 @@ static void ALSA_DetectDevices(SDL_AudioDevice **default_output, SDL_AudioDevice
SDL_bool has_default_output = SDL_FALSE, has_default_capture = SDL_FALSE;
ALSA_HotplugIteration(&has_default_output, &has_default_capture); // run once now before a thread continues to check.
if (has_default_output) {
- *default_output = SDL_AddAudioDevice(/*iscapture=*/SDL_FALSE, "ALSA default output device", NULL, SDL_strdup("default"));
+ *default_output = SDL_AddAudioDevice(/*iscapture=*/SDL_FALSE, "ALSA default output device", NULL, "default");
}
if (has_default_capture) {
- *default_capture = SDL_AddAudioDevice(/*iscapture=*/SDL_TRUE, "ALSA default capture device", NULL, SDL_strdup("default"));
+ *default_capture = SDL_AddAudioDevice(/*iscapture=*/SDL_TRUE, "ALSA default capture device", NULL, "default");
}
#if SDL_ALSA_HOTPLUG_THREAD