Henri Verbeet : wined3d: Don't leak the context array in the swapchain_init () error path.

Alexandre Julliard julliard at winehq.org
Wed Jan 20 14:29:44 CST 2010


Module: wine
Branch: master
Commit: ee1f2c465496710da5587ead34a674bc04fcc8eb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ee1f2c465496710da5587ead34a674bc04fcc8eb

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Jan 19 23:52:25 2010 +0100

wined3d: Don't leak the context array in the swapchain_init() error path.

---

 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);




More information about the wine-cvs mailing list