venus: fix a cmd tmp storage leak
authorYiwei Zhang <zzyiwei@chromium.org>
Tue, 4 Jul 2023 21:44:49 +0000 (14:44 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Jul 2023 22:36:47 +0000 (22:36 +0000)
When the pool is destroyed, cmds are implicitly freed. Cmd level allocs
have to be cleaned up to avoid leak.

Cc: mesa-stable
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24009>

src/virtio/vulkan/vn_command_buffer.c

index b2ad0b3..b1ee433 100644 (file)
@@ -701,6 +701,9 @@ vn_DestroyCommandPool(VkDevice device,
       vn_cs_encoder_fini(&cmd->cs);
       vn_object_base_fini(&cmd->base);
 
+      if (cmd->builder.tmp.data)
+         vk_free(&cmd->allocator, cmd->builder.tmp.data);
+
       list_for_each_entry_safe(struct vn_command_buffer_query_batch, batch,
                                &cmd->query_batches, head) {
          list_del(&batch->head);