From bfdb2e11e7d1a49f71ac8894944192135694ad39 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 24 Feb 2021 16:17:54 -0600 Subject: [PATCH] quartz/vmr9: Don't release the default presenter object if it could not be created. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/vmr9.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 57b219a6d26..c748e674081 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1383,19 +1383,23 @@ static HRESULT WINAPI VMR9FilterConfig_SetRenderingMode(IVMRFilterConfig9 *iface case VMR9Mode_Windowless: This->cookie = ~0; - hr = VMR9DefaultAllocatorPresenterImpl_create(This, (LPVOID*)&This->presenter); - if (SUCCEEDED(hr)) - hr = IVMRImagePresenter9_QueryInterface(This->presenter, - &IID_IVMRSurfaceAllocator9, (void **)&This->allocator); - if (FAILED(hr)) + if (FAILED(hr = VMR9DefaultAllocatorPresenterImpl_create(This, (void **)&This->presenter))) { - ERR("Unable to find Presenter interface\n"); + ERR("Failed to create default presenter, hr %#x.\n", hr); + break; + } + + if (FAILED(hr = IVMRImagePresenter9_QueryInterface(This->presenter, + &IID_IVMRSurfaceAllocator9, (void **)&This->allocator))) + { + ERR("Failed to query for IVMRSurfaceAllocator9, hr %#x.\n", hr); IVMRImagePresenter9_Release(This->presenter); This->allocator = NULL; This->presenter = NULL; + break; } - else - hr = IVMRSurfaceAllocator9_AdviseNotify(This->allocator, &This->IVMRSurfaceAllocatorNotify9_iface); + + hr = IVMRSurfaceAllocator9_AdviseNotify(This->allocator, &This->IVMRSurfaceAllocatorNotify9_iface); break; case VMR9Mode_Renderless: break;