Commit 1dcf3f7a authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32/tests: Fix a safearray leak (Valgrind).

parent a0e7c999
...@@ -1683,9 +1683,18 @@ static void test_SafeArrayChangeTypeEx(void) ...@@ -1683,9 +1683,18 @@ static void test_SafeArrayChangeTypeEx(void)
VariantInit(&v2); VariantInit(&v2);
hres = VariantChangeTypeEx(&v2, &v, 0, 0, VT_BSTR); hres = VariantChangeTypeEx(&v2, &v, 0, 0, VT_BSTR);
ok(hres != S_OK, "CTE VT_ARRAY|VT %d->BSTR succeeded\n", vt); if (vt == VT_INT_PTR || vt == VT_UINT_PTR)
{
ok(hres == DISP_E_BADVARTYPE, "expected DISP_E_BADVARTYPE, got 0x%08x\n", hres);
SafeArrayDestroy(sa);
}
else
{
ok(hres == DISP_E_TYPEMISMATCH, "got 0x%08x for vt=%d, instead of DISP_E_TYPEMISMATCH\n", hres, vt);
hres = VariantClear(&v);
ok(hres == S_OK, "expected S_OK, got 0x%08x\n", hres);
}
VariantClear(&v2); VariantClear(&v2);
VariantClear(&v);
} }
/* Can't change an array of one type into array of another type , even /* Can't change an array of one type into array of another type , even
......
...@@ -652,7 +652,7 @@ HRESULT VARIANT_ClearInd(VARIANTARG *pVarg) ...@@ -652,7 +652,7 @@ HRESULT VARIANT_ClearInd(VARIANTARG *pVarg)
*/ */
HRESULT WINAPI VariantClear(VARIANTARG* pVarg) HRESULT WINAPI VariantClear(VARIANTARG* pVarg)
{ {
HRESULT hres = S_OK; HRESULT hres;
TRACE("(%p->(%s%s))\n", pVarg, debugstr_VT(pVarg), debugstr_VF(pVarg)); TRACE("(%p->(%s%s))\n", pVarg, debugstr_VT(pVarg), debugstr_VF(pVarg));
...@@ -664,8 +664,7 @@ HRESULT WINAPI VariantClear(VARIANTARG* pVarg) ...@@ -664,8 +664,7 @@ HRESULT WINAPI VariantClear(VARIANTARG* pVarg)
{ {
if (V_ISARRAY(pVarg) || V_VT(pVarg) == VT_SAFEARRAY) if (V_ISARRAY(pVarg) || V_VT(pVarg) == VT_SAFEARRAY)
{ {
if (V_ARRAY(pVarg)) hres = SafeArrayDestroy(V_ARRAY(pVarg));
hres = SafeArrayDestroy(V_ARRAY(pVarg));
} }
else if (V_VT(pVarg) == VT_BSTR) else if (V_VT(pVarg) == VT_BSTR)
{ {
......
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