Commit 0519f53c authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

evr/tests: Fix resource leaks.

parent 86034654
......@@ -1061,10 +1061,11 @@ static void test_surface_sample(void)
ok(flags == 0x123, "Unexpected flags %#lx.\n", flags);
IMFSample_Release(sample);
done:
if (backbuffer)
IDirect3DSurface9_Release(backbuffer);
ok(!IDirect3DDevice9_Release(device), "Unexpected refcount.\n");
done:
DestroyWindow(window);
}
......@@ -1455,6 +1456,7 @@ static void test_default_presenter(void)
hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IDirect3DDeviceManager9_Release(dm);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
......@@ -1484,6 +1486,7 @@ static void test_default_presenter(void)
hr = IMFVideoDisplayControl_GetVideoWindow(display_control, &hwnd2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hwnd2 == hwnd, "Unexpected window %p.\n", hwnd2);
IMFVideoDisplayControl_Release(display_control);
/* Rate support. */
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFRateSupport, (void **)&rate_support);
......@@ -1511,7 +1514,7 @@ static void test_default_presenter(void)
IMFRateSupport_Release(rate_support);
IMFVideoPresenter_Release(presenter);
ok(!IMFVideoPresenter_Release(presenter), "Unexpected refcount.\n");
DestroyWindow(hwnd);
}
......@@ -1697,7 +1700,10 @@ static void test_MFCreateVideoSampleAllocator(void)
if (!(device = create_device(window)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
IMFMediaType_Release(video_type);
IMFMediaType_Release(media_type);
DestroyWindow(window);
return;
}
hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager);
......@@ -1735,14 +1741,13 @@ static void test_MFCreateVideoSampleAllocator(void)
hr = IMFMediaBuffer_Unlock(buffer);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFMediaBuffer_Release(buffer);
IMFSample_Release(sample);
IMFVideoSampleAllocator_Release(allocator);
IMFMediaType_Release(video_type);
IMFMediaType_Release(media_type);
IDirect3DDeviceManager9_Release(manager);
IDirect3DDevice9_Release(device);
done:
DestroyWindow(window);
}
......@@ -2067,6 +2072,7 @@ static void test_presenter_native_video_size(void)
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFTopologyServiceLookupClient_Release(lookup_client);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
......@@ -2141,6 +2147,7 @@ static void test_presenter_native_video_size(void)
ok((ratio.cx == 4 && ratio.cy == 3) || broken(!memcmp(&ratio, &size, sizeof(ratio))) /* < Win10 */,
"Unexpected ratio %lu x %lu.\n", ratio.cx, ratio.cy);
IMFTopologyServiceLookupClient_Release(lookup_client);
IMFMediaType_Release(video_type);
IMFVideoDisplayControl_Release(display_control);
IMFVideoPresenter_Release(presenter);
......@@ -2259,7 +2266,8 @@ static void test_presenter_video_window(void)
hr = IDirect3DDeviceManager9_CloseDeviceHandle(dm, hdevice);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFVideoDisplayControl_Release(display_control);
IDirect3DDeviceManager9_Release(dm);
ok(!IMFVideoDisplayControl_Release(display_control), "Unexpected refcount.\n");
DestroyWindow(window);
}
......@@ -2420,6 +2428,7 @@ static void test_presenter_media_type(void)
hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, &host.IMFTopologyServiceLookup_iface);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFTopologyServiceLookupClient_Release(lookup_client);
hr = IMFVideoDisplayControl_SetVideoWindow(display_control, window);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
......@@ -2431,6 +2440,7 @@ static void test_presenter_media_type(void)
hr = IMFTransform_SetInputType(mixer, 0, input_type, 0);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFMediaType_Release(input_type);
hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
......@@ -2463,6 +2473,8 @@ static void test_presenter_media_type(void)
IMFVideoDisplayControl_Release(display_control);
IMFVideoPresenter_Release(presenter);
IMFTransform_Release(mixer);
IDirect3DDeviceManager9_Release(manager);
IDirect3DDevice9_Release(device);
done:
DestroyWindow(window);
......@@ -2949,6 +2961,7 @@ static void test_mixer_samples(void)
ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr);
IMFDesiredSample_Clear(desired);
IMFDesiredSample_Release(desired);
hr = IMFTransform_ProcessInput(mixer, 0, NULL, 0);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
......@@ -3045,8 +3058,8 @@ static void test_mixer_samples(void)
IMFVideoProcessor_Release(processor);
IMFTransform_Release(mixer);
IDirect3DDevice9_Release(device);
IDirect3DDeviceManager9_Release(manager);
ok(!IDirect3DDevice9_Release(device), "Unexpected refcount.\n");
done:
DestroyWindow(window);
......@@ -3120,9 +3133,11 @@ static void test_mixer_render(void)
hr = IMFTransform_QueryInterface(mixer, &IID_IMFVideoProcessor, (void **)&processor);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFVideoProcessor_Release(processor);
hr = IMFTransform_QueryInterface(mixer, &IID_IMFVideoMixerControl, (void **)&mixer_control);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMFVideoMixerControl_Release(mixer_control);
/* Configure device and media types. */
hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager);
......@@ -3197,8 +3212,8 @@ static void test_mixer_render(void)
IDirect3DSurface9_Release(surface);
IMFTransform_Release(mixer);
IDirect3DDevice9_Release(device);
IDirect3DDeviceManager9_Release(manager);
ok(!IDirect3DDevice9_Release(device), "Unexpected refcount.\n");
done:
DestroyWindow(window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment