From 367a3561323871e9aad880c0405ca6a0d4188055 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 8 Mar 2020 18:56:07 -0700 Subject: [PATCH] Don't release the backbuffer on error, we didn't acquire it. --- src/render/direct3d/SDL_render_d3d.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 932c18363..83859334a 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1462,20 +1462,17 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, result = IDirect3DSurface9_GetDesc(backBuffer, &desc); if (FAILED(result)) { - IDirect3DSurface9_Release(backBuffer); return D3D_SetError("GetDesc()", result); } result = IDirect3DDevice9_CreateOffscreenPlainSurface(data->device, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL); if (FAILED(result)) { - IDirect3DSurface9_Release(backBuffer); return D3D_SetError("CreateOffscreenPlainSurface()", result); } result = IDirect3DDevice9_GetRenderTargetData(data->device, backBuffer, surface); if (FAILED(result)) { IDirect3DSurface9_Release(surface); - IDirect3DSurface9_Release(backBuffer); return D3D_SetError("GetRenderTargetData()", result); } @@ -1487,7 +1484,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, result = IDirect3DSurface9_LockRect(surface, &locked, &d3drect, D3DLOCK_READONLY); if (FAILED(result)) { IDirect3DSurface9_Release(surface); - IDirect3DSurface9_Release(backBuffer); return D3D_SetError("LockRect()", result); }