vkd3d: Avoid leaking "messages" when "error_blob" is NULL in vkd3d_serialize_root_signature(). (Valgrind).

This commit is contained in:
Henri Verbeet 2024-04-17 16:06:19 +02:00 committed by Alexandre Julliard
parent 742288127f
commit 8a7cb0295a
Notes: Alexandre Julliard 2024-04-17 23:30:14 +02:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/798

View File

@ -453,11 +453,10 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
if ((ret = vkd3d_shader_serialize_root_signature(&vkd3d_desc, &dxbc, &messages)) < 0) if ((ret = vkd3d_shader_serialize_root_signature(&vkd3d_desc, &dxbc, &messages)) < 0)
{ {
WARN("Failed to serialize root signature, vkd3d result %d.\n", ret); WARN("Failed to serialize root signature, vkd3d result %d.\n", ret);
if (error_blob && messages) if (!error_blob)
{ vkd3d_shader_free_messages(messages);
if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), error_blob))) else if (messages && FAILED(hr = vkd3d_blob_create(messages, strlen(messages), error_blob)))
ERR("Failed to create error blob, hr %s.\n", debugstr_hresult(hr)); ERR("Failed to create error blob, hr %s.\n", debugstr_hresult(hr));
}
return hresult_from_vkd3d_result(ret); return hresult_from_vkd3d_result(ret);
} }
vkd3d_shader_free_messages(messages); vkd3d_shader_free_messages(messages);