From 93e51dd33e61782c9f1bdbeccf2da4a5600789d6 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 5 Nov 2023 20:01:02 +0300 Subject: [PATCH] fix a possible memory leak in SDL_vasprintf() (cherry picked from commit 1a83bf2399c29f3028477225067bf6a106068f08) --- src/stdlib/SDL_string.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index ce0ec397f..8edd9334a 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -2004,6 +2004,7 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap) /* Check error code */ if (retval < 0) { + SDL_free(p); return retval; } @@ -2025,5 +2026,3 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap) } } } - -/* vi: set ts=4 sw=4 expandtab: */