[Mesa-dev] [PATCH 1/2] r600: Also destroy the GS copy shader when a r600_pipe_shader is destroyed

Gert Wollny gw.fossdev at gmail.com
Fri Nov 16 18:12:45 UTC 2018


From: Gert Wollny <gert.wollny at collabora.com>

Fixes memory leak:

104,104 bytes in 13 blocks are definitely lost in loss record 591 of 591
  at 0x4C2FE4D: calloc (vg_replace_malloc.c:711)
  by 0x7E155DE: generate_gs_copy_shader (r600_shader.c:2489)
  by 0x7E1BD1D: r600_shader_from_tgsi (r600_shader.c:4268)
  by 0x7E0E669: r600_pipe_shader_create (r600_shader.c:181)
  by 0x7D74E8D: r600_shader_select (r600_state_common.c:872)
  by 0x7D771C9: r600_update_derived_state (r600_state_common.c:1763)
  by 0x7D78506: r600_draw_vbo (r600_state_common.c:2077)

Fixes: 1371d65a7fbd695d3516861fe733685569d890d0
  r600g: initial support for geometry shaders on evergreen (v2)
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/gallium/drivers/r600/r600_shader.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 408939d110..a310e1b53c 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -301,6 +301,10 @@ void r600_pipe_shader_destroy(struct pipe_context *ctx UNUSED, struct r600_pipe_
 	r600_resource_reference(&shader->bo, NULL);
 	r600_bytecode_clear(&shader->shader.bc);
 	r600_release_command_buffer(&shader->command_buffer);
+        if (shader->gs_copy_shader) {
+           r600_pipe_shader_destroy(ctx, shader->gs_copy_shader);
+           free(shader->gs_copy_shader);
+        }
 }
 
 /*
-- 
2.18.1



More information about the mesa-dev mailing list