diff options
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index 82b21ae7cb..f2447b2638 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -396,6 +396,10 @@ char *OSystem_Win32::convertEncoding(const char* to, const char *from, const cha if (Common::String(from).equalsIgnoreCase("utf-16")) { // Allocate space for string and 2 ending zeros tmpStr = (WCHAR *) calloc(sizeof(char), length + 2); + if (!tmpStr) { + warning("Could not allocate memory for string conversion"); + return nullptr; + } memcpy(tmpStr, string, length); } else { tmpStr = Win32::ansiToUnicode(string, Win32::getCodePageId(from)); |