Hi Dmitry, On 01/13/16 03:47, Dmitry Timoshkov wrote:
Piotr Caban <piotr(a)codeweavers.com> wrote:
@@ -1316,11 +1316,19 @@ static void test_marshal_VARIANT(void) ok(*wirev, "wv[6] %08x\n", *wirev); /* win2k: this is lpsa. winxp: this is (char*)lpsa + 1 */ wirev++; check_safearray(wirev, lpsa); - VariantInit(&v2); + mem = CoTaskMemAlloc(1024); + lpsa_copy = lpsa2 = SafeArrayCreate(VT_I8, 1, &sab); + CoTaskMemFree(mem); + mem = lpsa2->pvData; + V_VT(&v2) = VT_UI4 | VT_ARRAY | VT_BYREF; + V_ARRAYREF(&v2) = &lpsa2;
Looks like the result of CoTaskMemAlloc/CoTaskMemFree is not used. I've added it intentionally so there's a bigger chance a different memory is allocated if safe array is reallocated (I'm trying to show that memory is reused without freeing and allocating it again). Of course there's no guarantee for that. I can remove it if it's preferable.
Thanks, Piotr