d3d11: Fix freed memory access when releasing device context (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-06-09 08:57:00 +03:00 committed by Alexandre Julliard
parent f74163ad58
commit d26275f905
1 changed files with 2 additions and 1 deletions

View File

@ -521,13 +521,14 @@ static ULONG STDMETHODCALLTYPE d3d11_device_context_Release(ID3D11DeviceContext1
if (!refcount) if (!refcount)
{ {
ID3D11Device2 *device = &context->device->ID3D11Device2_iface;
if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE) if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE)
{ {
wined3d_deferred_context_destroy(context->wined3d_context); wined3d_deferred_context_destroy(context->wined3d_context);
d3d11_device_context_cleanup(context); d3d11_device_context_cleanup(context);
heap_free(context); heap_free(context);
} }
ID3D11Device2_Release(&context->device->ID3D11Device2_iface); ID3D11Device2_Release(device);
} }
return refcount; return refcount;