From e01f0af5b04a9e1a72929c8e021f9e7939a33311 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Wed, 31 Jul 2019 20:27:28 +0200 Subject: WIN32: Check calloc return value in covertEncoding --- backends/platform/sdl/win32/win32.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backends') 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)); -- cgit v1.2.3