[PATCH 1/5] wined3d: Don't leak the context array in the swapchain_init() error path.

Henri Verbeet hverbeet at codeweavers.com
Tue Jan 19 16:52:25 CST 2010


---
 dlls/wined3d/swapchain.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 6493704..434eb3f 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -913,10 +913,15 @@ err:
         HeapFree(GetProcessHeap(), 0, swapchain->backBuffer);
     }
 
-    if (swapchain->context && swapchain->context[0])
+    if (swapchain->context)
     {
-        context_release(swapchain->context[0]);
-        context_destroy(device, swapchain->context[0]);
+        if (swapchain->context[0])
+        {
+            context_release(swapchain->context[0]);
+            context_destroy(device, swapchain->context[0]);
+            swapchain->num_contexts = 0;
+        }
+        HeapFree(GetProcessHeap(), 0, swapchain->context);
     }
 
     if (swapchain->frontBuffer) IWineD3DSurface_Release(swapchain->frontBuffer);
-- 
1.6.4.4




More information about the wine-patches mailing list