[PATCH 4/4] ddraw: Don't write out if a ddraw7 surface of size 0 is requested.

Alex Henrie alexhenrie24 at gmail.com
Fri Jan 6 01:07:30 CST 2017


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ddraw/ddraw.c        | 3 ---
 dlls/ddraw/tests/ddraw7.c | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index e761032a56..0e2e732c1d 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2813,10 +2813,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
     hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 7);
     wined3d_mutex_unlock();
     if (FAILED(hr))
-    {
-        *surface = NULL;
         return hr;
-    }
 
     *surface = &impl->IDirectDrawSurface7_iface;
     IDirectDraw7_AddRef(iface);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index e00bbcdb43..d438526093 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -1950,6 +1950,10 @@ static void test_surface_qi(void)
     surface_desc.dwSize = sizeof(surface_desc);
     surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
     surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
+
+    hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, (IDirectDrawSurface7 **)0xdeadbeef, NULL);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
     surface_desc.dwWidth = 512;
     surface_desc.dwHeight = 512;
     hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
-- 
2.11.0




More information about the wine-patches mailing list