quartz: AMFilterData_ParseFilterData returns a pointer to a pointer to filter data

Chris Robinson chris.kcat at gmail.com
Fri Feb 3 04:45:30 CST 2012


On Friday, February 03, 2012 2:43:57 PM Dmitry Timoshkov wrote:
> Aric Stewart <aric at codeweavers.com> wrote:
> > -    REGFILTER2 *prf2;
> > +    static REGFILTER2 *prf2;
> 
> What's the point of this change?

It returns a pointer to the pointer, so the variable needs to remain valid 
after the function exits. The code doesn't really feel safe, though. At the 
very least, I think the pointer should perhaps be made part of the 
implementation object, but even that feels kinda ugly. What happens if it's 
called multiple times?


REGFILTER **r1, **r2;

obj->ParseFilterData(data1, cb1, &r1);
obj->ParseFilterData(data2, cb2, &r2);

ok(r1 == r2, "Oops\n");

CoTaskMemFree(*r1);
/* *r2 is freed now, too */


Doesn't really seem right to me.



More information about the wine-devel mailing list