From 29a2594b7f3c216156bc1a266065710f614edc98 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 27 Jan 2016 13:38:04 +0100 Subject: [PATCH] wined3d: Don't leak the device context on failure in context_create(). Signed-off-by: Hans Leidekker Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 dabb5fd90d8..490c20feb89 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);