vulkan/overlay: fix crash on freeing NULL command buffer

It is legal to call vkFreeCommandBuffers() on NULL command buffers.

This fix requires eb41ce1b01 ("util/hash_table: Properly handle
the NULL key in hash_table_u64").

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 4438188f49 ("vulkan/overlay: record stats in command buffers and accumulate on exec/submit")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Lionel Landwerlin
2019-07-08 16:00:59 +03:00
parent 6271d16320
commit a72351cc76

View File

@@ -2026,6 +2026,10 @@ static void overlay_FreeCommandBuffers(
for (uint32_t i = 0; i < commandBufferCount; i++) {
struct command_buffer_data *cmd_buffer_data =
FIND_CMD_BUFFER_DATA(pCommandBuffers[i]);
/* It is legal to free a NULL command buffer*/
if (!cmd_buffer_data)
continue;
uint64_t count = (uintptr_t)find_object_data(HKEY(cmd_buffer_data->pipeline_query_pool));
if (count == 1) {
unmap_object(HKEY(cmd_buffer_data->pipeline_query_pool));