Zhiyi Zhang : mfplat/tests: Fix resource leaks.

Alexandre Julliard julliard at winehq.org
Thu Jun 30 16:34:20 CDT 2022


Module: wine
Branch: master
Commit: 2e0a56257a15af8dee6ebad55f180591b1c1e18c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2e0a56257a15af8dee6ebad55f180591b1c1e18c

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Wed Jun 29 17:53:16 2022 +0800

mfplat/tests: Fix resource leaks.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53235
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>

---

 dlls/mfplat/tests/mfplat.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 48f7a444add..deed2408a41 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -6639,11 +6639,12 @@ static void test_MFCreateDXSurfaceBuffer(void)
     IMF2DBuffer2_Release(_2dbuffer2);
 
     IMFMediaBuffer_Release(buffer);
+    IDirect3DDevice9_Release(device);
 
 done:
     if (backbuffer)
         IDirect3DSurface9_Release(backbuffer);
-    IDirect3D9_Release(d3d);
+    ok(!IDirect3D9_Release(d3d), "Unexpected refcount.\n");
     DestroyWindow(window);
 }
 
@@ -7618,6 +7619,8 @@ static void test_sample_allocator_d3d9(void)
 
     IMFVideoSampleAllocator_Release(allocator);
     IMFMediaType_Release(video_type);
+    IDirect3DDeviceManager9_Release(d3d9_manager);
+    IDirect3DDevice9_Release(d3d9_device);
 
 done:
     IDirect3D9_Release(d3d9);
@@ -7725,6 +7728,7 @@ static void test_sample_allocator_d3d11(void)
     hr = IMFMediaBuffer_Unlock(buffer);
     ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
+    IMFMediaBuffer_Release(buffer);
     IMFSample_Release(sample);
 
     IMFVideoSampleAllocator_Release(allocator);
@@ -7867,7 +7871,7 @@ static void test_sample_allocator_d3d11(void)
 
 static void test_sample_allocator_d3d12(void)
 {
-    IMFVideoSampleAllocator *allocator;
+    IMFVideoSampleAllocator *allocator = NULL;
     D3D12_HEAP_PROPERTIES heap_props;
     IMFDXGIDeviceManager *manager;
     D3D12_HEAP_FLAGS heap_flags;
@@ -7955,11 +7959,12 @@ static void test_sample_allocator_d3d12(void)
 
     ID3D12Resource_Release(resource);
     IMFDXGIBuffer_Release(dxgi_buffer);
+    IMFMediaBuffer_Release(buffer);
     IMFSample_Release(sample);
 
-    IMFVideoSampleAllocator_Release(allocator);
-
 done:
+    if (allocator)
+        IMFVideoSampleAllocator_Release(allocator);
     IMFDXGIDeviceManager_Release(manager);
     ID3D12Device_Release(device);
 }




More information about the wine-cvs mailing list