summaryrefslogtreecommitdiff
path: root/desktop/win32/source
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/win32/source')
-rw-r--r--desktop/win32/source/applauncher/launcher.cxx7
-rw-r--r--desktop/win32/source/loader.cxx4
2 files changed, 5 insertions, 6 deletions
diff --git a/desktop/win32/source/applauncher/launcher.cxx b/desktop/win32/source/applauncher/launcher.cxx
index d3114aa2d804..987b3e2985e1 100644
--- a/desktop/win32/source/applauncher/launcher.cxx
+++ b/desktop/win32/source/applauncher/launcher.cxx
@@ -81,11 +81,10 @@ extern "C" int APIENTRY wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int )
DWORD dwError = GetLastError();
- LPWSTR lpMsgBuf;
+ LPWSTR lpMsgBuf = nullptr;
FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
@@ -98,7 +97,7 @@ extern "C" int APIENTRY wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int )
MessageBoxW( nullptr, lpMsgBuf, nullptr, MB_OK | MB_ICONERROR );
// Free the buffer.
- LocalFree( lpMsgBuf );
+ HeapFree( GetProcessHeap(), 0, lpMsgBuf );
return dwError;
}
diff --git a/desktop/win32/source/loader.cxx b/desktop/win32/source/loader.cxx
index 72bcafc50457..4425c1e697d9 100644
--- a/desktop/win32/source/loader.cxx
+++ b/desktop/win32/source/loader.cxx
@@ -27,10 +27,10 @@ void fail()
{
LPWSTR buf = nullptr;
FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, nullptr,
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr,
GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, nullptr);
MessageBoxW(nullptr, buf, nullptr, MB_OK | MB_ICONERROR);
- LocalFree(buf);
+ HeapFree(GetProcessHeap(), 0, buf);
TerminateProcess(GetCurrentProcess(), 255);
}