[PATCH] quartz/vmr9: Don't release the default presenter object if it could not be created.

Zebediah Figura z.figura12 at gmail.com
Wed Feb 24 16:17:54 CST 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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("Failed to create default presenter, hr %#x.\n", hr);
+            break;
+        }
+
+        if (FAILED(hr = IVMRImagePresenter9_QueryInterface(This->presenter,
+                    &IID_IVMRSurfaceAllocator9, (void **)&This->allocator)))
         {
-            ERR("Unable to find Presenter interface\n");
+            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;
-- 
2.30.1




More information about the wine-devel mailing list