ddraw: Avoid accessing free'd memory on an error path in ddraw_surface_create().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-06-07 21:18:37 +02:00 committed by Alexandre Julliard
parent 62e253796e
commit 2afd2f705f
1 changed files with 2 additions and 3 deletions

View File

@ -5754,10 +5754,9 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
{
WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
hr = desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP ? DDERR_INVALIDPARAMS : DDERR_INVALIDCAPS;
HeapFree(GetProcessHeap(), 0, texture);
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
return DDERR_INVALIDPARAMS;
return DDERR_INVALIDCAPS;
return hr;
}
}