From: Lionel Landwerlin Date: Mon, 8 Jul 2019 13:00:59 +0000 (+0300) Subject: vulkan/overlay: fix crash on freeing NULL command buffer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a72351cc763c75d57aee8a85a64859657c3ec7d8;p=mesa.git vulkan/overlay: fix crash on freeing NULL command buffer It is legal to call vkFreeCommandBuffers() on NULL command buffers. This fix requires eb41ce1b012f24 ("util/hash_table: Properly handle the NULL key in hash_table_u64"). Signed-off-by: Lionel Landwerlin Fixes: 4438188f492e1f ("vulkan/overlay: record stats in command buffers and accumulate on exec/submit") Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp index c4344f96aa4..a1fc30779f7 100644 --- a/src/vulkan/overlay-layer/overlay.cpp +++ b/src/vulkan/overlay-layer/overlay.cpp @@ -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));