summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2019-07-08 16:00:59 +0300
committerJuan A. Suarez Romero <jasuarez@igalia.com>2019-07-09 10:32:19 +0000
commit1e3b87790322a8d508995ea72689cc0fbbecd88e (patch)
treec023d4a50140dddfd46630be66cfaeb16001d9bd
parent87fc035c533350c4c4290d147a60b4b4937e6908 (diff)
downloadmesa-1e3b87790322a8d508995ea72689cc0fbbecd88e.tar.gz
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 <lionel.g.landwerlin@intel.com> Fixes: 4438188f492e1f ("vulkan/overlay: record stats in command buffers and accumulate on exec/submit") Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> (cherry picked from commit a72351cc763c75d57aee8a85a64859657c3ec7d8)
-rw-r--r--src/vulkan/overlay-layer/overlay.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp
index 4e5c50e2ad7..bc365bf6cc6 100644
--- a/src/vulkan/overlay-layer/overlay.cpp
+++ b/src/vulkan/overlay-layer/overlay.cpp
@@ -2044,6 +2044,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));