From 9150989a711261cfc3a42e1e3e12a081f209c3a2 Mon Sep 17 00:00:00 2001
From: Manuel Moos <[EMAIL REDACTED]>
Date: Sun, 6 Aug 2023 20:48:39 +0200
Subject: [PATCH] Always fill *buf
It is an out parameter and callers might be tempted to free it no matter
what the main return value says.
---
src/SDL12_compat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 192b9b7fb..fba2e5642 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -8454,12 +8454,12 @@ SDL_LoadWAV_RW(SDL12_RWops *rwops12, int freerwops12,
SDL_RWops *rwops20 = RWops12to20(rwops12);
SDL_AudioSpec *retval = NULL;
+ *buf = NULL;
+
if (!rwops20) {
return NULL;
}
- *buf = NULL;
-
/* SDL2's LoadWAV requires a seekable stream, but SDL 1.2 didn't,
so if the stream appears unseekable, try to load it into a
memory rwops that we _can_ seek in */