From 9e502bf9aad760416f5529344f3781824db731cd Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Tue, 13 Sep 2016 09:19:53 +0200 Subject: SDL: Plug a memory leak in OSystem_SDL::getTextFromClipboard --- backends/platform/sdl/sdl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'backends/platform/sdl/sdl.cpp') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 18f2a49bdd..a175c530ee 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -477,8 +477,9 @@ Common::String OSystem_SDL::getTextFromClipboard() { #if SDL_VERSION_ATLEAST(2, 0, 0) char *text = SDL_GetClipboardText(); - if (text == nullptr) return ""; - return text; + Common::String strText = text; + SDL_free(text); + return strText; #else return ""; #endif -- cgit v1.2.3