diff options
author | Jaromir Wysoglad | 2019-07-31 20:27:28 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-08-24 18:12:45 +0300 |
commit | e01f0af5b04a9e1a72929c8e021f9e7939a33311 (patch) | |
tree | 7a7a87257e1b803be57c4779caeb0f5136faf6d6 | |
parent | 5043dec13c4019a858c397b0f2db44a75c2d0adc (diff) | |
download | scummvm-rg350-e01f0af5b04a9e1a72929c8e021f9e7939a33311.tar.gz scummvm-rg350-e01f0af5b04a9e1a72929c8e021f9e7939a33311.tar.bz2 scummvm-rg350-e01f0af5b04a9e1a72929c8e021f9e7939a33311.zip |
WIN32: Check calloc return value in covertEncoding
-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)); |