Re2: EnumMedia patch

Robert Shearman rob at codeweavers.com
Sun May 1 06:54:14 CDT 2005


Maarten Lankhorst wrote:

> Robert Shearman wrote:
>
>> Maarten Lankhorst wrote:
>>
>>> This patch fixes AM_MEDIA_TYPE->pbFormat not being handled 
>>> correctly, unfortunately, this also means some stuff has to be 
>>> rewritten to avoid memleaks, instead of 
>>> CoTaskMemFree(AM_MEDIA_TYPE), DeleteMediaType has to be used.. This 
>>> also fixes the errors i had with msn webcam, i feel like i stumbled 
>>> over every bug in quartz now......
>>>
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>> @@ -45,6 +46,7 @@ void DeleteMediaType(AM_MEDIA_TYPE * pMe
>>>         IUnknown_Release(pMediaType->pUnk);
>>>         pMediaType->pUnk = NULL;
>>>     }
>>> +    CoTaskMemFree(pMediaType);
>>> }
>>>
>>> BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const 
>>> AM_MEDIA_TYPE * pmt2, BOOL bWildcards)
>>>  
>>>
>>
>> This change is wrong. DeleteMediaType is not supposed to free the 
>> memory used for the AM_MEDIA_TYPE structure itself as the function is 
>> also used in places where the AM_MEDIA_TYPE was not allocated using 
>> CoTaskMemAlloc.
>>
>> Rob
>>
> This change is right, if you don't want to release the format block 
> you need to use freemediatype... quoting msdn...


Ok, the way it was designed in Wine didn't match the DShow SDK way. You 
still need to fix up the callers before making this change then.

Rob



More information about the wine-devel mailing list