shlwapi: Handle NULL ptr return from allocation (Coverity).

This commit is contained in:
Marcus Meissner 2010-06-03 13:10:17 +02:00 committed by Alexandre Julliard
parent fb1d5310ad
commit f01c43c47b
1 changed files with 6 additions and 0 deletions

View File

@ -4506,12 +4506,18 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
{
const WCHAR *ptr;
UINT len = LoadStringW(hInstance, LOWORD(lpText), (LPWSTR)&ptr, 0);
if (len)
{
szText = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
if (szText) LoadStringW(hInstance, LOWORD(lpText), szText, len + 1);
}
pszText = szText;
if (!pszText) {
WARN("Failed to load id %d\n", LOWORD(lpText));
__ms_va_end(args);
return 0;
}
}
else
pszText = lpText;