From 12265697c94260d90e4247ccccfe25a92e1b4978 Mon Sep 17 00:00:00 2001
From: Wohlstand <[EMAIL REDACTED]>
Date: Wed, 29 Sep 2021 04:25:29 +0300
Subject: [PATCH] mixer.c: Fix memory leak in case Mix_LoadWAV_RW fails to read
the magic.
---
src/mixer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mixer.c b/src/mixer.c
index 16e53dcf..610d7c8f 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -702,6 +702,7 @@ Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc)
/* Find out what kind of audio file this is */
if (SDL_RWread(src, magic, 1, 4) != 4) {
+ SDL_free(chunk);
if (freesrc) {
SDL_RWclose(src);
}