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

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-01-27 13:38:04 +01:00 committed by Alexandre Julliard
parent 4c1d6d27d0
commit 29a2594b7f
1 changed files with 2 additions and 1 deletions

View File

@ -1456,7 +1456,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
unsigned int s; unsigned int s;
int swap_interval; int swap_interval;
DWORD state; DWORD state;
HDC hdc; HDC hdc = 0;
BOOL hdc_is_private = FALSE; BOOL hdc_is_private = FALSE;
TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle); 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; return ret;
out: out:
if (hdc) wined3d_release_dc(swapchain->win_handle, hdc);
device->shader_backend->shader_free_context_data(ret); device->shader_backend->shader_free_context_data(ret);
device->adapter->fragment_pipe->free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret);
HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_event_queries);