Commit 315e87e1 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

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

parent d8723657
...@@ -698,16 +698,20 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab ...@@ -698,16 +698,20 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
} }
if (out->const_set_count) 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); sizeof(*out->const_set) * out->const_set_count);
if (!out->const_set) if (new_alloc)
{ {
ERR("Out of memory.\n"); out->const_set = new_alloc;
hr = E_OUTOFMEMORY;
goto cleanup;
}
out->const_set_size = out->const_set_count; out->const_set_size = out->const_set_count;
} }
else
{
WARN("Out of memory.\n");
}
}
cleanup: cleanup:
ID3DXConstantTable_Release(ctab); ID3DXConstantTable_Release(ctab);
return hr; return hr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment