[PATCH 1/4] oleaut32: Add tests for safearray unmarshaling into passed variant

Dmitry Timoshkov dmitry at baikal.ru
Wed Jan 13 01:19:18 CST 2016


Piotr Caban <piotr at 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.

I'd suggest to add a comment about this so that noone would try to remove
"dead code".

-- 
Dmitry.



More information about the wine-devel mailing list