SDL: Fix memory leak in dialog

From db9b4ba2fac25989b4ef1911fc716cef58dcb6bd Mon Sep 17 00:00:00 2001
From: meyraud705 <[EMAIL REDACTED]>
Date: Fri, 5 Apr 2024 18:50:44 +0200
Subject: [PATCH] Fix memory leak in dialog

---
 src/dialog/SDL_dialog_utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/dialog/SDL_dialog_utils.c b/src/dialog/SDL_dialog_utils.c
index 5d29a23fe4194..865821c8ccf20 100644
--- a/src/dialog/SDL_dialog_utils.c
+++ b/src/dialog/SDL_dialog_utils.c
@@ -48,6 +48,7 @@ char *convert_filters(const SDL_DialogFileFilter *filters, NameTransform ntf,
                                    ext_suffix);
 
         if (!converted) {
+            SDL_free(combined);
             return NULL;
         }
 
@@ -68,6 +69,7 @@ char *convert_filters(const SDL_DialogFileFilter *filters, NameTransform ntf,
 
         SDL_strlcat(combined, converted, new_length);
         SDL_strlcat(combined, terminator, new_length);
+        SDL_free(converted);
     }
 
     return combined;