Commit f9c40c37 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

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

parent d68c13a8
...@@ -3143,7 +3143,7 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ ...@@ -3143,7 +3143,7 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */
return E_INVALIDARG; return E_INVALIDARG;
} }
len = pvarSrc->u.capropvar.cElems; 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)) if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT))
{ {
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
......
...@@ -263,7 +263,6 @@ static void test_validtypes(void) ...@@ -263,7 +263,6 @@ static void test_validtypes(void)
{ {
ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt); 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); 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); ok(!U(copy).caub.pElems, "%u: expected NULL, got %p\n", i, U(copy).caub.pElems);
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment