[PATCH 2/5] dxgi: Free the wined3d object when device creation fails (Valgrind).

Matteo Bruni mbruni at codeweavers.com
Wed Aug 27 11:40:49 CDT 2014


---
 dlls/dxgi/device.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 837c57f..0f3ae7d 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -350,7 +350,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
     IWineDXGIDeviceParent *dxgi_device_parent;
     IWineDXGIAdapter *wine_adapter;
     UINT adapter_ordinal;
-    struct wined3d *wined3d;
+    struct wined3d *wined3d = NULL;
     void *layer_base;
     HRESULT hr;
     WINED3DCAPS caps;
@@ -430,6 +430,12 @@ fail:
         wined3d_device_decref(device->wined3d_device);
         LeaveCriticalSection(&dxgi_cs);
     }
+    else if (wined3d)
+    {
+        EnterCriticalSection(&dxgi_cs);
+        wined3d_decref(wined3d);
+        LeaveCriticalSection(&dxgi_cs);
+    }
     if (device->factory) IWineDXGIFactory_Release(device->factory);
     if (device->child_layer) IUnknown_Release(device->child_layer);
     return hr;
-- 
1.8.5.5




More information about the wine-patches mailing list