[Mesa-stable] [PATCH] anv/cmd_buffer: Reset state in cmd_buffer_destroy

Jason Ekstrand jason at jlekstrand.net
Fri Oct 6 03:58:54 UTC 2017


This ensures that everything gets cleaned up properly.  In particular,
it fixes a memory leak where we were leaking the push constants structs.

Cc: mesa-stable at lists.freedesktop.org
---
 src/intel/vulkan/anv_cmd_buffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index 6a0e822..8668320 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -271,12 +271,13 @@ anv_cmd_buffer_destroy(struct anv_cmd_buffer *cmd_buffer)
 {
    list_del(&cmd_buffer->pool_link);
 
+   anv_cmd_state_reset(cmd_buffer);
+
    anv_cmd_buffer_fini_batch_bo_chain(cmd_buffer);
 
    anv_state_stream_finish(&cmd_buffer->surface_state_stream);
    anv_state_stream_finish(&cmd_buffer->dynamic_state_stream);
 
-   vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
    vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
 }
 
-- 
2.5.0.400.gff86faf



More information about the mesa-stable mailing list