[PATCH] mf: Add missing ::Release of clock timer.

Nikolay Sivov nsivov at codeweavers.com
Tue May 5 06:07:36 CDT 2020


On 5/4/20 10:56 PM, Derek Lesho wrote:
> --- a/dlls/mf/session.c
> +++ b/dlls/mf/session.c
> @@ -4014,6 +4014,7 @@ static HRESULT present_clock_schedule_timer(struct presentation_clock *clock, DW
>   
>       if (FAILED(hr = MFCreateAsyncResult(&timer->IUnknown_iface, &clock->timer_callback, NULL, &result)))
>           return hr;
> +    IUnknown_Release(&timer->IUnknown_iface);
>   
>       hr = MFScheduleWorkItemEx(result, -time, &timer->key);
>       IMFAsyncResult_Release(result);
This is a wrong place to release it. Creating result object grabs a 
timer reference, scheduling it grabs result object reference,
and original reference is released.

Timer object is created with refcount of 1, additional reference is 
taken by result object, another one by cancellation object, optionally.
It's released on timer callback, on cancel request, or on clock release. 
The only path it's leaked I think is on
error in present_clock_timer_SetTimer(). Does the attached patch work?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: settimer.diff
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200505/f8370f92/attachment.bin>


More information about the wine-devel mailing list