diff options
author | Bastien Bouclet | 2016-09-13 09:19:53 +0200 |
---|---|---|
committer | Bastien Bouclet | 2016-09-13 09:19:53 +0200 |
commit | 9e502bf9aad760416f5529344f3781824db731cd (patch) | |
tree | 31fd98d5ca4bd8c6d089351c4dffe359bef71d87 /backends/platform/sdl | |
parent | 10fd5046c2fb8b8f42ff01ae180c958395d99f3a (diff) | |
download | scummvm-rg350-9e502bf9aad760416f5529344f3781824db731cd.tar.gz scummvm-rg350-9e502bf9aad760416f5529344f3781824db731cd.tar.bz2 scummvm-rg350-9e502bf9aad760416f5529344f3781824db731cd.zip |
SDL: Plug a memory leak in OSystem_SDL::getTextFromClipboard
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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 |