oleaut32: SafeArrayAllocData should succeed when cbElements is 0.
This commit is contained in:
parent
3e8adc3d26
commit
72a84fbf06
dlls/oleaut32
|
@ -228,7 +228,7 @@ static SAFEARRAY* SAFEARRAY_Create(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsab
|
|||
if (ulSize)
|
||||
psa->cbElements = ulSize;
|
||||
|
||||
if (FAILED(SafeArrayAllocData(psa)))
|
||||
if (!psa->cbElements || FAILED(SafeArrayAllocData(psa)))
|
||||
{
|
||||
SafeArrayDestroyDescriptor(psa);
|
||||
psa = NULL;
|
||||
|
@ -533,19 +533,16 @@ HRESULT WINAPI SafeArrayAllocData(SAFEARRAY *psa)
|
|||
{
|
||||
ULONG ulSize = SAFEARRAY_GetCellCount(psa);
|
||||
|
||||
hRet = E_OUTOFMEMORY;
|
||||
psa->pvData = SAFEARRAY_Malloc(ulSize * psa->cbElements);
|
||||
|
||||
if (psa->cbElements)
|
||||
if (psa->pvData)
|
||||
{
|
||||
psa->pvData = SAFEARRAY_Malloc(ulSize * psa->cbElements);
|
||||
|
||||
if (psa->pvData)
|
||||
{
|
||||
hRet = S_OK;
|
||||
TRACE("%u bytes allocated for data at %p (%u objects).\n",
|
||||
ulSize * psa->cbElements, psa->pvData, ulSize);
|
||||
}
|
||||
hRet = S_OK;
|
||||
TRACE("%u bytes allocated for data at %p (%u objects).\n",
|
||||
ulSize * psa->cbElements, psa->pvData, ulSize);
|
||||
}
|
||||
else
|
||||
hRet = E_OUTOFMEMORY;
|
||||
}
|
||||
return hRet;
|
||||
}
|
||||
|
|
|
@ -690,10 +690,7 @@ static void test_SafeArrayAllocDestroyDescriptor(void)
|
|||
sa->rgsabound[0].lLbound = 1;
|
||||
|
||||
hres = SafeArrayAllocData(sa);
|
||||
todo_wine
|
||||
{
|
||||
ok(hres == S_OK, "SafeArrayAllocData gave hres 0x%x\n", hres);
|
||||
}
|
||||
ok(hres == S_OK, "SafeArrayAllocData gave hres 0x%x\n", hres);
|
||||
}
|
||||
|
||||
static void test_SafeArrayCreateLockDestroy(void)
|
||||
|
|
Loading…
Reference in New Issue