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)
char *text = SDL_GetClipboardText();
if (text == nullptr) return "";
return text;
Common::String strText = text;
SDL_free(text);
return strText;
#else
return "";
#endif