From c7fc60a237a6ba5acc555ff6c408bfb34631b996 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 17 Apr 2024 16:09:19 +0200 Subject: [PATCH] vkd3d: Avoid leaking "messages" when "error_blob" is NULL in vkd3d_serialize_versioned_root_signature(). (Valgrind). --- libs/vkd3d/vkd3d_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/vkd3d/vkd3d_main.c b/libs/vkd3d/vkd3d_main.c index 63043b7e..29305fbd 100644 --- a/libs/vkd3d/vkd3d_main.c +++ b/libs/vkd3d/vkd3d_main.c @@ -493,11 +493,10 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN if ((ret = vkd3d_shader_serialize_root_signature(vkd3d_desc, &dxbc, &messages)) < 0) { WARN("Failed to serialize root signature, vkd3d result %d.\n", ret); - if (error_blob && messages) - { - if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), error_blob))) - ERR("Failed to create error blob, hr %s.\n", debugstr_hresult(hr)); - } + if (!error_blob) + vkd3d_shader_free_messages(messages); + 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)); return hresult_from_vkd3d_result(ret); } vkd3d_shader_free_messages(messages);