Mesa (staging/20.0): glsl: fix a memory leak with resource_set

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 13 19:01:46 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: a429930e0ac97694b69eb1f13c3050eca8753449
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a429930e0ac97694b69eb1f13c3050eca8753449

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Mon Jan 27 10:05:20 2020 +0200

glsl: fix a memory leak with resource_set

   ==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 <tapani.palli at intel.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3574>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3574>
(cherry picked from commit f7d1bf075ab833eb39c35f9e213dc4fc115b46b1)

---

 .pick_status.json            | 2 +-
 src/compiler/glsl/linker.cpp | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9f062fcd9f9..083d493f663 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -148,7 +148,7 @@
         "description": "glsl: fix a memory leak with resource_set",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "a6aedc662ebbcac747475324abe3791ff67fc1a8"
     },
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 880f42ae171..519fc14a4d2 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4036,8 +4036,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;



More information about the mesa-commit mailing list