From 6aef6ae9a801cf6060b5570806d6108088b6b8e0 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Mon, 17 Feb 2025 19:13:42 +0100
Subject: [PATCH] AddPulseAudioDevice(): Fix use-after-free
---
src/audio/pulseaudio/SDL_pulseaudio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 1fd3a640a38ba..886dbd8ffdbcf 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -778,8 +778,8 @@ static void AddPulseAudioDevice(const bool recording, const char *description, c
SDL_free(handle);
} else {
handle->device_index = index;
+ SDL_AddAudioDevice(recording, description, &spec, handle);
}
- SDL_AddAudioDevice(recording, description, &spec, handle);
}
}