SDL: Plug a memory leak in OSystem_SDL::getTextFromClipboard

This commit is contained in:
Bastien Bouclet 2016-09-13 09:19:53 +02:00
parent 10fd5046c2
commit 9e502bf9aa

View file

@ -477,8 +477,9 @@ Common::String OSystem_SDL::getTextFromClipboard() {
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
char *text = SDL_GetClipboardText(); char *text = SDL_GetClipboardText();
if (text == nullptr) return ""; Common::String strText = text;
return text; SDL_free(text);
return strText;
#else #else
return ""; return "";
#endif #endif