oleaut32/tests: Fix safearray leaks, test return value after array destruction.

This commit is contained in:
Nikolay Sivov 2011-01-23 01:24:06 +03:00 committed by Alexandre Julliard
parent 7ee7f0843b
commit a5582d77cf
3 changed files with 86 additions and 34 deletions

View File

@ -219,9 +219,11 @@ static void check_for_VT_INT_PTR(void)
bound.lLbound = 0; bound.lLbound = 0;
a = SafeArrayCreate(VT_INT_PTR, 1, &bound); a = SafeArrayCreate(VT_INT_PTR, 1, &bound);
if (a) { if (a) {
HRESULT hres;
trace("VT_INT_PTR is supported\n"); trace("VT_INT_PTR is supported\n");
HAVE_OLEAUT32_INT_PTR = TRUE; HAVE_OLEAUT32_INT_PTR = TRUE;
SafeArrayDestroy(a); hres = SafeArrayDestroy(a);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
else { else {
trace("VT_INT_PTR is not supported\n"); trace("VT_INT_PTR is not supported\n");
@ -944,7 +946,8 @@ test_LockUnlock_Vector:
bVector ? "vector " : "\n", count, hres); bVector ? "vector " : "\n", count, hres);
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
if (bVector == FALSE && pSafeArrayCreateVector) if (bVector == FALSE && pSafeArrayCreateVector)
@ -1079,7 +1082,8 @@ static void test_SafeArrayGetPutElement(void)
} }
} }
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
static void test_SafeArrayGetPutElement_BSTR(void) static void test_SafeArrayGetPutElement_BSTR(void)
@ -1113,7 +1117,8 @@ static void test_SafeArrayGetPutElement_BSTR(void)
ok(hres == S_OK, "Failed to get bstr element at hres 0x%x\n", hres); ok(hres == S_OK, "Failed to get bstr element at hres 0x%x\n", hres);
if (hres == S_OK) if (hres == S_OK)
ok(SysStringLen(value) == SysStringLen(gotvalue), "Got len %d instead of %d\n", SysStringLen(gotvalue), SysStringLen(value)); ok(SysStringLen(value) == SysStringLen(gotvalue), "Got len %d instead of %d\n", SysStringLen(gotvalue), SysStringLen(value));
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
SysFreeString(value); SysFreeString(value);
SysFreeString(gotvalue); SysFreeString(gotvalue);
} }
@ -1174,7 +1179,8 @@ static void test_SafeArrayGetPutElement_IUnknown(void)
ok(hres == S_OK, "Failed to get bstr element at hres 0x%x\n", hres); ok(hres == S_OK, "Failed to get bstr element at hres 0x%x\n", hres);
if (hres == S_OK) if (hres == S_OK)
ok(value == gotvalue, "Got %p instead of %p\n", gotvalue, value); ok(value == gotvalue, "Got %p instead of %p\n", gotvalue, value);
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(tunk_xref == 2,"Failed to decrement refcount of iface.\n"); ok(tunk_xref == 2,"Failed to decrement refcount of iface.\n");
} }
@ -1208,7 +1214,8 @@ static void test_SafeArrayRedim_IUnknown(void)
hres = SafeArrayRedim(sa, &sab); hres = SafeArrayRedim(sa, &sab);
ok(hres == S_OK, "Failed to shrink array hres 0x%x\n", hres); ok(hres == S_OK, "Failed to shrink array hres 0x%x\n", hres);
ok(tunk_xref == 1, "Failed to decrement refcount\n"); ok(tunk_xref == 1, "Failed to decrement refcount\n");
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
static void test_SafeArrayGetPutElement_VARIANT(void) static void test_SafeArrayGetPutElement_VARIANT(void)
@ -1248,7 +1255,8 @@ static void test_SafeArrayGetPutElement_VARIANT(void)
if (V_VT(&value) == V_VT(&gotvalue)) if (V_VT(&value) == V_VT(&gotvalue))
ok(V_I4(&value) == V_I4(&gotvalue), "Got %d instead of %d\n", V_I4(&value), V_VT(&gotvalue)); ok(V_I4(&value) == V_I4(&gotvalue), "Got %d instead of %d\n", V_I4(&value), V_VT(&gotvalue));
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
@ -1323,7 +1331,8 @@ static void test_SafeArrayCopyData(void)
ok(hres == E_INVALIDARG, "Smaller copy last dimension hres 0x%x\n", hres); ok(hres == E_INVALIDARG, "Smaller copy last dimension hres 0x%x\n", hres);
sacopy->rgsabound[3].cElements += 1; sacopy->rgsabound[3].cElements += 1;
SafeArrayDestroy(sacopy); hres = SafeArrayDestroy(sacopy);
ok(hres == S_OK, "got 0x%08x\n", hres);
sacopy = NULL; sacopy = NULL;
hres = pSafeArrayCopyData(sa, sacopy); hres = pSafeArrayCopyData(sa, sacopy);
ok(hres == E_INVALIDARG, "->Null copy hres 0x%x\n", hres); ok(hres == E_INVALIDARG, "->Null copy hres 0x%x\n", hres);
@ -1335,10 +1344,12 @@ static void test_SafeArrayCopyData(void)
ok(SafeArrayGetElemsize(sa) == SafeArrayGetElemsize(sacopy),"elemsize wrong\n"); ok(SafeArrayGetElemsize(sa) == SafeArrayGetElemsize(sacopy),"elemsize wrong\n");
ok(SafeArrayGetDim(sa) == SafeArrayGetDim(sacopy),"dimensions wrong\n"); ok(SafeArrayGetDim(sa) == SafeArrayGetDim(sacopy),"dimensions wrong\n");
ok(!memcmp(sa->pvData, sacopy->pvData, size * sizeof(int)), "compared different\n"); ok(!memcmp(sa->pvData, sacopy->pvData, size * sizeof(int)), "compared different\n");
SafeArrayDestroy(sacopy); hres = SafeArrayDestroy(sacopy);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
static void test_SafeArrayCreateEx(void) static void test_SafeArrayCreateEx(void)
@ -1391,7 +1402,8 @@ static void test_SafeArrayCreateEx(void)
ok(hres == S_OK && IsEqualGUID(&guid, &IID_IUnknown), "Set bad IID\n"); ok(hres == S_OK && IsEqualGUID(&guid, &IID_IUnknown), "Set bad IID\n");
} }
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
sa = pSafeArrayCreateEx(VT_DISPATCH, 1, sab, NULL); sa = pSafeArrayCreateEx(VT_DISPATCH, 1, sab, NULL);
@ -1409,7 +1421,8 @@ static void test_SafeArrayCreateEx(void)
ok(IsEqualGUID(&guid, &IID_IDispatch), "CreateEx (NULL) bad IID\n"); ok(IsEqualGUID(&guid, &IID_IDispatch), "CreateEx (NULL) bad IID\n");
} }
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
sa = pSafeArrayCreateEx(VT_UNKNOWN, 1, sab, NULL); sa = pSafeArrayCreateEx(VT_UNKNOWN, 1, sab, NULL);
@ -1427,7 +1440,8 @@ static void test_SafeArrayCreateEx(void)
ok(IsEqualGUID(&guid, &IID_IUnknown), "CreateEx (NULL-Unk) bad IID\n"); ok(IsEqualGUID(&guid, &IID_IUnknown), "CreateEx (NULL-Unk) bad IID\n");
} }
} }
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
/* VT_RECORD failure case */ /* VT_RECORD failure case */
@ -1446,7 +1460,8 @@ static void test_SafeArrayCreateEx(void)
if (sa) if (sa)
{ {
ok(sa->cbElements == RECORD_SIZE_FAIL, "Altered size to %d\n", sa->cbElements); ok(sa->cbElements == RECORD_SIZE_FAIL, "Altered size to %d\n", sa->cbElements);
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(iRec->clearCalled == sab[0].cElements, "Destroy->Clear called %d times\n", iRec->clearCalled); ok(iRec->clearCalled == sab[0].cElements, "Destroy->Clear called %d times\n", iRec->clearCalled);
} }
@ -1473,13 +1488,19 @@ static void test_SafeArrayCreateEx(void)
ok(sa->cbElements == RECORD_SIZE,"Elemsize is %d\n", sa->cbElements); ok(sa->cbElements == RECORD_SIZE,"Elemsize is %d\n", sa->cbElements);
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(iRec->sizeCalled == 1, "Destroy->GetSize called %d times\n", iRec->sizeCalled); ok(iRec->sizeCalled == 1, "Destroy->GetSize called %d times\n", iRec->sizeCalled);
ok(iRec->clearCalled == sab[0].cElements, "Destroy->Clear called %d times\n", iRec->clearCalled); ok(iRec->clearCalled == sab[0].cElements, "Destroy->Clear called %d times\n", iRec->clearCalled);
ok(iRec->ref == START_REF_COUNT, "Wrong iRec refcount %d\n", iRec->ref); ok(iRec->ref == START_REF_COUNT, "Wrong iRec refcount %d\n", iRec->ref);
} }
else else
SafeArrayDestroy(sa); {
hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
}
IRecordInfo_Release(&iRec->IRecordInfo_iface);
} }
static void test_SafeArrayClear(void) static void test_SafeArrayClear(void)
@ -1518,7 +1539,8 @@ static void test_SafeArrayClear(void)
hres = VariantClear(&v); hres = VariantClear(&v);
ok(hres == DISP_E_BADVARTYPE, "VariantClear: hres 0x%x\n", hres); ok(hres == DISP_E_BADVARTYPE, "VariantClear: hres 0x%x\n", hres);
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
static void test_SafeArrayCopy(void) static void test_SafeArrayCopy(void)
@ -1554,8 +1576,10 @@ static void test_SafeArrayCopy(void)
"VariantCopy: hres 0x%x, Type %d\n", hres, V_VT(&vDst)); "VariantCopy: hres 0x%x, Type %d\n", hres, V_VT(&vDst));
ok(V_ARRAY(&vDst) != sa, "VariantClear: Performed shallow copy\n"); ok(V_ARRAY(&vDst) != sa, "VariantClear: Performed shallow copy\n");
SafeArrayDestroy(V_ARRAY(&vSrc)); hres = SafeArrayDestroy(V_ARRAY(&vSrc));
SafeArrayDestroy(V_ARRAY(&vDst)); ok(hres == S_OK, "got 0x%08x\n", hres);
hres = SafeArrayDestroy(V_ARRAY(&vDst));
ok(hres == S_OK, "got 0x%08x\n", hres);
hres = SafeArrayAllocDescriptor(1, &sa); hres = SafeArrayAllocDescriptor(1, &sa);
ok(hres == S_OK, "SafeArrayAllocDescriptor failed with error 0x%08x\n", hres); ok(hres == S_OK, "SafeArrayAllocDescriptor failed with error 0x%08x\n", hres);
@ -1568,8 +1592,10 @@ static void test_SafeArrayCopy(void)
hres = SafeArrayCopy(sa, &sa2); hres = SafeArrayCopy(sa, &sa2);
ok(hres == S_OK, "SafeArrayCopy failed with error 0x%08x\n", hres); ok(hres == S_OK, "SafeArrayCopy failed with error 0x%08x\n", hres);
SafeArrayDestroy(sa2); hres = SafeArrayDestroy(sa2);
SafeArrayDestroy(sa); ok(hres == S_OK, "got 0x%08x\n", hres);
hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
} }
#define MKARRAY(low,num,typ) sab.lLbound = low; sab.cElements = num; \ #define MKARRAY(low,num,typ) sab.lLbound = low; sab.cElements = num; \
@ -1605,7 +1631,8 @@ static void test_SafeArrayChangeTypeEx(void)
} }
/* VT_VECTOR|VT_UI1 -> VT_BSTR */ /* VT_VECTOR|VT_UI1 -> VT_BSTR */
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
if (pSafeArrayCreateVector) if (pSafeArrayCreateVector)
{ {
sa = pSafeArrayCreateVector(VT_UI1, 0, strlen(szHello)+1); sa = pSafeArrayCreateVector(VT_UI1, 0, strlen(szHello)+1);
@ -1640,7 +1667,15 @@ static void test_SafeArrayChangeTypeEx(void)
if (vt == VT_UI1) if (vt == VT_UI1)
continue; continue;
MKARRAYCONT(0,1,vt); sab.lLbound = 0;
sab.cElements = 1;
sa = SafeArrayCreate(vt, 1, &sab);
if (!sa) continue;
V_VT(&v) = VT_ARRAY|vt;
V_ARRAY(&v) = sa;
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); ok(hres != S_OK, "CTE VT_ARRAY|VT %d->BSTR succeeded\n", vt);
VariantClear(&v2); VariantClear(&v2);
@ -1663,7 +1698,8 @@ static void test_SafeArrayChangeTypeEx(void)
ok(hres == DISP_E_TYPEMISMATCH, "CTE VT_ARRAY|VT_UI1->VT_ARRAY|VT_I1 returned %x\n", hres); ok(hres == DISP_E_TYPEMISMATCH, "CTE VT_ARRAY|VT_UI1->VT_ARRAY|VT_I1 returned %x\n", hres);
/* But can change to the same array type */ /* But can change to the same array type */
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
sa = pSafeArrayCreateVector(VT_UI1, 0, 1); sa = pSafeArrayCreateVector(VT_UI1, 0, 1);
ok(sa != NULL, "CreateVector() failed.\n"); ok(sa != NULL, "CreateVector() failed.\n");
if (!sa) if (!sa)
@ -1672,7 +1708,8 @@ static void test_SafeArrayChangeTypeEx(void)
V_ARRAY(&v) = sa; V_ARRAY(&v) = sa;
hres = VariantChangeTypeEx(&v2, &v, 0, 0, VT_ARRAY|VT_UI1); hres = VariantChangeTypeEx(&v2, &v, 0, 0, VT_ARRAY|VT_UI1);
ok(hres == S_OK, "CTE VT_ARRAY|VT_UI1->VT_ARRAY|VT_UI1 returned %x\n", hres); ok(hres == S_OK, "CTE VT_ARRAY|VT_UI1->VT_ARRAY|VT_UI1 returned %x\n", hres);
SafeArrayDestroy(sa); hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
VariantClear(&v2); VariantClear(&v2);
} }

View File

@ -1099,6 +1099,7 @@ static void test_typelibmarshal(void)
ok(V_VT(&varresult) == VT_BSTR, "Return value should be of type BSTR instead of %d\n", V_VT(&varresult)); ok(V_VT(&varresult) == VT_BSTR, "Return value should be of type BSTR instead of %d\n", V_VT(&varresult));
ok(!lstrcmpW(V_BSTR(&varresult), szTestTest), "Return value should have been \"TestTest\" instead of %s\n", wine_dbgstr_w(V_BSTR(&varresult))); ok(!lstrcmpW(V_BSTR(&varresult), szTestTest), "Return value should have been \"TestTest\" instead of %s\n", wine_dbgstr_w(V_BSTR(&varresult)));
VariantClear(&varresult); VariantClear(&varresult);
SysFreeString(bstr);
/* call SetOleColor with large negative VT_I4 param */ /* call SetOleColor with large negative VT_I4 param */
VariantInit(&vararg[0]); VariantInit(&vararg[0]);

View File

@ -256,6 +256,7 @@ static void test_marshal_LPSAFEARRAY(void)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
next = LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); next = LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa);
ok(next - buffer == expected, "Marshaled %u bytes, expected %u\n", (ULONG) (next - buffer), expected); ok(next - buffer == expected, "Marshaled %u bytes, expected %u\n", (ULONG) (next - buffer), expected);
ok(lpsa->cLocks == 7, "got lock count %u\n", lpsa->cLocks);
check_safearray(buffer, lpsa); check_safearray(buffer, lpsa);
@ -268,12 +269,14 @@ static void test_marshal_LPSAFEARRAY(void)
SafeArrayGetVartype(lpsa, &vt); SafeArrayGetVartype(lpsa, &vt);
SafeArrayGetVartype(lpsa2, &vt2); SafeArrayGetVartype(lpsa2, &vt2);
ok(vt == vt2, "vts differ %x %x\n", vt, vt2); ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
todo_wine ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2); LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
} }
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
lpsa->cLocks = 0; lpsa->cLocks = 0;
SafeArrayDestroy(lpsa); hr = SafeArrayDestroy(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* use two dimensions */ /* use two dimensions */
sab[0].lLbound = 5; sab[0].lLbound = 5;
@ -300,6 +303,7 @@ static void test_marshal_LPSAFEARRAY(void)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
next = LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); next = LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa);
ok(next - buffer == expected, "Marshaled %u bytes, expected %u\n", (ULONG) (next - buffer), expected); ok(next - buffer == expected, "Marshaled %u bytes, expected %u\n", (ULONG) (next - buffer), expected);
ok(lpsa->cLocks == 7, "got lock count %u\n", lpsa->cLocks);
check_safearray(buffer, lpsa); check_safearray(buffer, lpsa);
@ -312,12 +316,14 @@ static void test_marshal_LPSAFEARRAY(void)
SafeArrayGetVartype(lpsa, &vt); SafeArrayGetVartype(lpsa, &vt);
SafeArrayGetVartype(lpsa2, &vt2); SafeArrayGetVartype(lpsa2, &vt2);
ok(vt == vt2, "vts differ %x %x\n", vt, vt2); ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
todo_wine ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2); LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
} }
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
lpsa->cLocks = 0; lpsa->cLocks = 0;
SafeArrayDestroy(lpsa); hr = SafeArrayDestroy(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* test NULL safe array */ /* test NULL safe array */
lpsa = NULL; lpsa = NULL;
@ -371,7 +377,8 @@ static void test_marshal_LPSAFEARRAY(void)
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
lpsa->cLocks = 0; lpsa->cLocks = 0;
SafeArrayDestroy(lpsa); hr = SafeArrayDestroy(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* VARTYPE-less arrays can be marshaled if cbElements is 1,2,4 or 8 as type SF_In */ /* VARTYPE-less arrays can be marshaled if cbElements is 1,2,4 or 8 as type SF_In */
hr = SafeArrayAllocDescriptor(1, &lpsa); hr = SafeArrayAllocDescriptor(1, &lpsa);
@ -398,8 +405,10 @@ static void test_marshal_LPSAFEARRAY(void)
"Marshaled %u bytes, expected %u\n", (ULONG) (next - buffer), expected); "Marshaled %u bytes, expected %u\n", (ULONG) (next - buffer), expected);
check_safearray(buffer, lpsa); check_safearray(buffer, lpsa);
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
SafeArrayDestroyData(lpsa); hr = SafeArrayDestroyData(lpsa);
SafeArrayDestroyDescriptor(lpsa); ok(hr == S_OK, "got 0x%08x\n", hr);
hr = SafeArrayDestroyDescriptor(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* Test an array of VT_BSTR */ /* Test an array of VT_BSTR */
sab[0].lLbound = 3; sab[0].lLbound = 3;
@ -479,7 +488,8 @@ static void test_marshal_LPSAFEARRAY(void)
} }
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
SafeArrayDestroy(lpsa); hr = SafeArrayDestroy(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* VARTYPE-less arrays with FADF_VARIANT */ /* VARTYPE-less arrays with FADF_VARIANT */
hr = SafeArrayAllocDescriptor(1, &lpsa); hr = SafeArrayAllocDescriptor(1, &lpsa);
@ -509,8 +519,10 @@ static void test_marshal_LPSAFEARRAY(void)
lpsa->cbElements = 16; /* VARIANT wire size */ lpsa->cbElements = 16; /* VARIANT wire size */
check_safearray(buffer, lpsa); check_safearray(buffer, lpsa);
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
SafeArrayDestroyData(lpsa); hr = SafeArrayDestroyData(lpsa);
SafeArrayDestroyDescriptor(lpsa); ok(hr == S_OK, "got 0x%08x\n", hr);
hr = SafeArrayDestroyDescriptor(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
} }
static void check_bstr(void *buffer, BSTR b) static void check_bstr(void *buffer, BSTR b)
@ -765,6 +777,7 @@ static void test_marshal_VARIANT(void)
DECIMAL dec, dec2; DECIMAL dec, dec2;
HeapUnknown *heap_unknown; HeapUnknown *heap_unknown;
DWORD expected; DWORD expected;
HRESULT hr;
stubMsg.RpcMsg = &rpcMsg; stubMsg.RpcMsg = &rpcMsg;
@ -1394,7 +1407,8 @@ static void test_marshal_VARIANT(void)
VARIANT_UserFree(&umcb.Flags, &v2); VARIANT_UserFree(&umcb.Flags, &v2);
} }
HeapFree(GetProcessHeap(), 0, oldbuffer); HeapFree(GetProcessHeap(), 0, oldbuffer);
SafeArrayDestroy(lpsa); hr = SafeArrayDestroy(lpsa);
ok(hr == S_OK, "got 0x%08x\n", hr);
/*** VARIANT BYREF ***/ /*** VARIANT BYREF ***/
VariantInit(&v); VariantInit(&v);