windowscodecs: Do not leak profile on errors (Coverity).

This commit is contained in:
Marcus Meissner 2013-03-15 20:09:14 +01:00 committed by Alexandre Julliard
parent 339ec9c4ed
commit 4641ed5c95
1 changed files with 10 additions and 2 deletions

View File

@ -126,8 +126,16 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len)
}
ret = ReadFile(handle, *profile, size.u.LowPart, &count, NULL);
CloseHandle(handle);
if (!ret) return HRESULT_FROM_WIN32(GetLastError());
if (count != size.u.LowPart) return E_FAIL;
if (!ret) {
HeapFree (GetProcessHeap(),0,*profile);
*profile = NULL;
return HRESULT_FROM_WIN32(GetLastError());
}
if (count != size.u.LowPart) {
HeapFree (GetProcessHeap(),0,*profile);
*profile = NULL;
return E_FAIL;
}
*len = count;
return S_OK;
}