From: André Hentschel Subject: d3drm/tests: Fix crash when surface can't be created Message-Id: <6e060b0d-d58c-9858-4806-21cafaa00d7f@dawncrow.de> Date: Sun, 28 Aug 2016 16:49:47 +0200 Signed-off-by: André Hentschel --- Should fix crashes like: https://test.winehq.org/data/a83d5d3b83042d2305de0595c0d03e4e7bf1e29e/xp_wxppro-sp3-last/d3drm:d3drm.html dlls/d3drm/tests/d3drm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 0d92823..183e613 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -3819,6 +3819,10 @@ static void test_create_device_from_surface1(void) desc.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE; hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + if (FAILED(hr)) + goto cleanup; + surface_ref1 = get_refcount((IUnknown *)surface); hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, ddraw, surface, NULL); @@ -3936,6 +3940,8 @@ static void test_create_device_from_surface1(void) ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); ref1 = IDirectDrawSurface_Release(surface); ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + +cleanup: IDirect3DRM_Release(d3drm1); IDirectDraw_Release(ddraw); DestroyWindow(window);