SDL: SDL_iconv_string: avoid memory leak if realloc() fails.

From a2b13e585cde7445316724123b051faae2a72c45 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 2 Dec 2021 02:28:24 +0300
Subject: [PATCH] SDL_iconv_string: avoid memory leak if realloc() fails.

---
 src/stdlib/SDL_iconv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c
index ec7715f44a..1a45dba14c 100644
--- a/src/stdlib/SDL_iconv.c
+++ b/src/stdlib/SDL_iconv.c
@@ -867,6 +867,7 @@ SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
                 stringsize *= 2;
                 string = (char *) SDL_realloc(string, stringsize);
                 if (!string) {
+                    SDL_free(oldstring);
                     SDL_iconv_close(cd);
                     return NULL;
                 }