From 39c2f9737308052027a5a2648c3ccfba1b890667 Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Mon, 18 Sep 2023 13:40:55 +0200
Subject: [PATCH] Fix NULL dereference in SDL_OpenAudio
---
src/audio/SDL_audio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 6dfd8b7de96c..4ea06839f0ac 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1672,10 +1672,12 @@ SDL_AudioStream *SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_Au
if (!stream) {
SDL_CloseAudioDevice(logdevid);
- } else if (SDL_BindAudioStream(logdevid, stream) == -1) {
+ return NULL; // error string should already be set.
+ }
+ if (SDL_BindAudioStream(logdevid, stream) == -1) {
SDL_DestroyAudioStream(stream);
SDL_CloseAudioDevice(logdevid);
- stream = NULL;
+ return NULL; // error string should already be set.
}
logdev->simplified = SDL_TRUE; // forbid further binding changes on this logical device.