Commit d315f6b1 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Check for NULL pointers returned by HeapAlloc.

parent 6be39b60
...@@ -974,7 +974,8 @@ BOOL WineEngInit(void) ...@@ -974,7 +974,8 @@ BOOL WineEngInit(void)
valuelen++; /* returned value doesn't include room for '\0' */ valuelen++; /* returned value doesn't include room for '\0' */
valueW = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR)); valueW = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR));
data = HeapAlloc(GetProcessHeap(), 0, datalen * sizeof(WCHAR)); data = HeapAlloc(GetProcessHeap(), 0, datalen * sizeof(WCHAR));
if (valueW && data)
{
dlen = datalen * sizeof(WCHAR); dlen = datalen * sizeof(WCHAR);
vlen = valuelen; vlen = valuelen;
while(RegEnumValueW(hkey, i++, valueW, &vlen, NULL, &type, data, while(RegEnumValueW(hkey, i++, valueW, &vlen, NULL, &type, data,
...@@ -982,13 +983,13 @@ BOOL WineEngInit(void) ...@@ -982,13 +983,13 @@ BOOL WineEngInit(void)
if(((LPWSTR)data)[0] && ((LPWSTR)data)[1] == ':') if(((LPWSTR)data)[0] && ((LPWSTR)data)[1] == ':')
if(wine_get_unix_file_name((LPWSTR)data, unixname, sizeof(unixname))) if(wine_get_unix_file_name((LPWSTR)data, unixname, sizeof(unixname)))
AddFontFileToList(unixname, NULL, FALSE); AddFontFileToList(unixname, NULL, FALSE);
/* reset dlen and vlen */ /* reset dlen and vlen */
dlen = datalen; dlen = datalen;
vlen = valuelen; vlen = valuelen;
} }
HeapFree(GetProcessHeap(), 0, data); }
HeapFree(GetProcessHeap(), 0, valueW); if (data) HeapFree(GetProcessHeap(), 0, data);
if (valueW) HeapFree(GetProcessHeap(), 0, valueW);
RegCloseKey(hkey); RegCloseKey(hkey);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment