[Scummvm-git-logs] scummvm master -> ca23e7fa2de6b4c6c567ac1ce8ddac1fa25da6ce

rvanlaar noreply at scummvm.org
Fri Nov 29 19:41:23 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ca23e7fa2d SDL: Fix memory leak


Commit: ca23e7fa2de6b4c6c567ac1ce8ddac1fa25da6ce
    https://github.com/scummvm/scummvm/commit/ca23e7fa2de6b4c6c567ac1ce8ddac1fa25da6ce
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2024-11-29T20:41:06+01:00

Commit Message:
SDL: Fix memory leak

The variable `locales` wasn't freed when it succesfully
contained data.

Changed paths:
    backends/platform/sdl/sdl.cpp


diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 613ba6181d4..8acdce51f85 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -661,7 +661,9 @@ Common::String OSystem_SDL::getSystemLanguage() const {
 	SDL_Locale *locales = SDL_GetPreferredLocales();
 	if (locales) {
 		if (locales[0].language != NULL) {
-			return Common::String::format("%s_%s", locales[0].country, locales[0].language);
+			Common::String str = Common::String::format("%s_%s", locales[0].country, locales[0].language);
+			SDL_free(locales);
+			return str;
 		}
 		SDL_free(locales);
 	}




More information about the Scummvm-git-logs mailing list