[PATCH 0/2] MR3326: wmp: Two crash fixes
The typelib is only created if something requests it, so it may be NULL at PROCESS_DETACH. WMPControls_play doesn't release and NULL out the filter_graph it creates on failure. So if a call to play() fails after making filter_graph but before making media_controls, calling play() again on the same instance will crash. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3326
From: Tim Clem <tclem(a)codeweavers.com> --- dlls/wmp/wmp_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/wmp/wmp_main.c b/dlls/wmp/wmp_main.c index 1f2afd8b244..69679fdcb86 100644 --- a/dlls/wmp/wmp_main.c +++ b/dlls/wmp/wmp_main.c @@ -89,7 +89,8 @@ static void release_typelib(void) if (typeinfos[i]) ITypeInfo_Release(typeinfos[i]); - ITypeLib_Release(typelib); + if (typelib) + ITypeLib_Release(typelib); } static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3326
From: Tim Clem <tclem(a)codeweavers.com> --- dlls/wmp/player.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c index 254d04d23f8..583f5847907 100644 --- a/dlls/wmp/player.c +++ b/dlls/wmp/player.c @@ -1509,6 +1509,35 @@ static HRESULT WINAPI WMPControls_play(IWMPControls *iface) hres = IGraphBuilder_QueryInterface(This->filter_graph, &IID_IBasicAudio, (void**)&This->basic_audio); if (SUCCEEDED(hres)) hres = IWMPSettings_put_volume(&This->IWMPSettings_iface, This->volume); + + if (FAILED(hres)) + { + if (This->filter_graph) + { + IGraphBuilder_Release(This->filter_graph); + This->filter_graph = NULL; + } + if (This->media_control) + { + IMediaControl_Release(This->media_control); + This->media_control = NULL; + } + if (This->media_seeking) + { + IMediaSeeking_Release(This->media_seeking); + This->media_seeking = NULL; + } + if (This->media_event) + { + IMediaEvent_Release(This->media_event); + This->media_event = NULL; + } + if (This->basic_audio) + { + IBasicAudio_Release(This->basic_audio); + This->basic_audio = NULL; + } + } } update_state(This, DISPID_WMPCOREEVENT_PLAYSTATECHANGE, wmppsTransitioning); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3326
This merge request was approved by Zebediah Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3326
participants (3)
-
Tim Clem -
Tim Clem (@tclem) -
Zebediah Figura (@zfigura)