From a878b0fae82962da017c56fdde564d15b8b4d4c7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 18 Dec 2018 19:57:23 +0300 Subject: [PATCH] d3d9: Fix crash in d3d9_indexbuffer_Release(). Signed-off-by: Paul Gofman Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index 7e178f278fd..840d7e95ea4 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c @@ -402,12 +402,13 @@ static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface) if (!refcount) { + struct wined3d_buffer *draw_buffer = buffer->draw_buffer; IDirect3DDevice9Ex *device = buffer->parent_device; wined3d_mutex_lock(); wined3d_buffer_decref(buffer->wined3d_buffer); - if (buffer->draw_buffer) - wined3d_buffer_decref(buffer->draw_buffer); + if (draw_buffer) + wined3d_buffer_decref(draw_buffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */