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

From ff4eec8dbf609ef52506cf0442eddfa5791a2008 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 14 Dec 2021 23:55:50 +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 d26e51851..9177879e9 100644
--- a/src/stdlib/SDL_iconv.c
+++ b/src/stdlib/SDL_iconv.c
@@ -855,6 +855,7 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inb
 				stringsize *= 2;
 				string = SDL_realloc(string, stringsize);
 				if ( !string ) {
+					SDL_free(oldstring);
 					SDL_iconv_close(cd);
 					return NULL;
 				}