d3dx9: Fix potential memory leak on HeapReAlloc() failure in get_constants_desc().

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2017-07-11 14:27:01 +03:00 committed by Alexandre Julliard
parent d8723657d2
commit 315e87e172

View file

@ -698,15 +698,19 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
}
if (out->const_set_count)
{
out->const_set = HeapReAlloc(GetProcessHeap(), 0, out->const_set,
struct d3dx_const_param_eval_output *new_alloc;
new_alloc = HeapReAlloc(GetProcessHeap(), 0, out->const_set,
sizeof(*out->const_set) * out->const_set_count);
if (!out->const_set)
if (new_alloc)
{
ERR("Out of memory.\n");
hr = E_OUTOFMEMORY;
goto cleanup;
out->const_set = new_alloc;
out->const_set_size = out->const_set_count;
}
else
{
WARN("Out of memory.\n");
}
out->const_set_size = out->const_set_count;
}
cleanup:
ID3DXConstantTable_Release(ctab);