shlwapi: Avoid potential NULL pointer access if HeapAlloc fails.

This commit is contained in:
Dmitry Timoshkov 2014-02-17 14:48:35 +09:00 committed by Alexandre Julliard
parent 968d464f17
commit 35a9587613
1 changed files with 13 additions and 14 deletions

View File

@ -364,12 +364,11 @@ static const IStreamVtbl SHLWAPI_fsVTable =
*/
static IStream *IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode)
{
ISHFileStream* fileStream;
ISHFileStream *fileStream;
fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream));
if (!fileStream) return NULL;
if (fileStream)
{
fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable;
fileStream->ref = 1;
fileStream->hFile = hFile;
@ -377,7 +376,7 @@ static IStream *IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode)
fileStream->lpszPath = StrDupW(lpszPath);
fileStream->type = 0; /* FIXME */
fileStream->grfStateBits = 0; /* FIXME */
}
TRACE ("Returning %p\n", fileStream);
return &fileStream->IStream_iface;
}