From e57c12c3ff3162eb3b32aa03dcdabedfca4e1d45 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 19 May 2026 10:20:41 -0400
Subject: [PATCH] metadata: Fixed memory leak.
(cherry picked from commit e5e462e01bdca269998a541d0bff3ca3d03e70b1)
---
src/SDL_mixer_metadata_tags.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/SDL_mixer_metadata_tags.c b/src/SDL_mixer_metadata_tags.c
index fefcd7fe..fd088425 100644
--- a/src/SDL_mixer_metadata_tags.c
+++ b/src/SDL_mixer_metadata_tags.c
@@ -118,8 +118,10 @@ static void id3v1_set_tag(SDL_PropertiesID props, const char *key, const Uint8 *
{
if (!SDL_HasProperty(props, key)) { // in case there are multiple ID3v1 tags appended to a file, we'll take the last one, since we parse backwards from the end of file.
char *src_buf = parse_id3v1_ansi_string(buffer, len);
- if (src_buf && *src_buf) {
- SDL_SetStringProperty(props, key, src_buf);
+ if (src_buf) {
+ if (*src_buf) {
+ SDL_SetStringProperty(props, key, src_buf);
+ }
SDL_free(src_buf);
}
}