oleaut32/safearray: Fix allocation error check for array descriptor.
This commit is contained in:
parent
30063b5439
commit
90090332a2
|
@ -172,11 +172,15 @@ static ULONG SAFEARRAY_GetCellCount(const SAFEARRAY *psa)
|
|||
/* Allocate a descriptor for an array */
|
||||
static HRESULT SAFEARRAY_AllocDescriptor(ULONG ulSize, SAFEARRAY **ppsaOut)
|
||||
{
|
||||
*ppsaOut = (SAFEARRAY*)((char*)SAFEARRAY_Malloc(ulSize + SAFEARRAY_HIDDEN_SIZE) + SAFEARRAY_HIDDEN_SIZE);
|
||||
char *ptr = SAFEARRAY_Malloc(ulSize + SAFEARRAY_HIDDEN_SIZE);
|
||||
|
||||
if (!*ppsaOut)
|
||||
return E_UNEXPECTED;
|
||||
if (!ptr)
|
||||
{
|
||||
*ppsaOut = NULL;
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
*ppsaOut = (SAFEARRAY*)(ptr + SAFEARRAY_HIDDEN_SIZE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue