From f7d1bf075ab833eb39c35f9e213dc4fc115b46b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Mon, 27 Jan 2020 10:05:20 +0200 Subject: [PATCH] glsl: fix a memory leak with resource_set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ==7265== 248 (120 direct, 128 indirect) bytes in 1 blocks are definitely lost in loss record 1,438 of 1,465 ==7265== at 0x483980B: malloc (vg_replace_malloc.c:309) ==7265== by 0x598A2AB: ralloc_size (ralloc.c:119) ==7265== by 0x598F861: _mesa_set_create (set.c:127) ==7265== by 0x599079D: _mesa_pointer_set_create (set.c:570) ==7265== by 0x58BD7D1: build_program_resource_list(gl_context*, gl_shader_program*, bool) (linker.cpp:4026) ==7265== by 0x548231B: st_link_shader (st_glsl_to_ir.cpp:170) ==7265== by 0x54DA269: _mesa_glsl_link_shader (ir_to_mesa.cpp:3119) Fixes: a6aedc66 ("st/glsl_to_nir: use nir based program resource list builder") Signed-off-by: Tapani Pälli Reviewed-by: Timothy Arceri Tested-by: Marge Bot Part-of: --- src/compiler/glsl/linker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index d69dff7bbd9..77e7489a0a6 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4040,8 +4040,10 @@ build_program_resource_list(struct gl_context *ctx, return; } - if (add_packed_varyings_only) + if (add_packed_varyings_only) { + _mesa_set_destroy(resource_set, NULL); return; + } if (!add_fragdata_arrays(ctx, shProg, resource_set)) return; -- 2.30.2