ole32: If number of VT_VECTOR elements is 0 there is no need to allocate memory.

This commit is contained in:
Dmitry Timoshkov 2014-04-18 18:10:19 +09:00 committed by Alexandre Julliard
parent d68c13a894
commit f9c40c37cd
2 changed files with 1 additions and 2 deletions

View File

@ -3143,7 +3143,7 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */
return E_INVALIDARG;
}
len = pvarSrc->u.capropvar.cElems;
pvarDest->u.capropvar.pElems = CoTaskMemAlloc(len * elemSize);
pvarDest->u.capropvar.pElems = len ? CoTaskMemAlloc(len * elemSize) : NULL;
if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT))
{
for (i = 0; i < len; i++)

View File

@ -263,7 +263,6 @@ static void test_validtypes(void)
{
ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
ok(!U(copy).caub.cElems, "%u: expected 0, got %d\n", i, U(copy).caub.cElems);
todo_wine
ok(!U(copy).caub.pElems, "%u: expected NULL, got %p\n", i, U(copy).caub.pElems);
}
else