Hans Leidekker : wined3d: Don' t leak the device context on failure in context_create().

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 27 11:27:21 CST 2016


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jan 27 13:38:04 2016 +0100

wined3d: Don't leak the device context on failure in context_create().

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index dabb5fd..490c20f 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1456,7 +1456,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     unsigned int s;
     int swap_interval;
     DWORD state;
-    HDC hdc;
+    HDC hdc = 0;
     BOOL hdc_is_private = FALSE;
 
     TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle);
@@ -1837,6 +1837,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     return ret;
 
 out:
+    if (hdc) wined3d_release_dc(swapchain->win_handle, hdc);
     device->shader_backend->shader_free_context_data(ret);
     device->adapter->fragment_pipe->free_context_data(ret);
     HeapFree(GetProcessHeap(), 0, ret->free_event_queries);




More information about the wine-cvs mailing list