[PATCH] devenum: Avoid an invalid free (Valgrind).

Zebediah Figura z.figura12 at gmail.com
Thu Dec 13 09:33:18 CST 2018


On 12/13/18 3:15 AM, Alexandre Julliard wrote:
> Zebediah Figura <z.figura12 at gmail.com> writes:
> 
>> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
>> ---
>>   dlls/devenum/mediacatenum.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c
>> index 5fa2f008dc..efa69195eb 100644
>> --- a/dlls/devenum/mediacatenum.c
>> +++ b/dlls/devenum/mediacatenum.c
>> @@ -419,7 +419,8 @@ static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(IMoniker *iface)
>>       TRACE("(%p) ref=%d\n", This, ref);
>>   
>>       if (ref == 0) {
>> -        CoTaskMemFree(This->name);
>> +        if (This->type != DEVICE_DMO)
>> +            CoTaskMemFree(This->name);
> 
> I'd suggest getting rid of the union instead, and simply keep name as
> NULL when not needed.
> 

That's probably cleaner, yes.

Actually I think I'd like to split this into two different monikers; 
DMOs do most things differently anyway.



More information about the wine-devel mailing list