Mesa (master): lima: fix nir shader memory leak

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 7 23:21:12 UTC 2019


Module: Mesa
Branch: master
Commit: d939f5d463f4e13e6deb78c4f87904fa524755fc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d939f5d463f4e13e6deb78c4f87904fa524755fc

Author: Erico Nunes <nunes.erico at gmail.com>
Date:   Mon Oct 28 19:59:54 2019 +0100

lima: fix nir shader memory leak

Fix memory leak on allocation for nir shader, reported by valgrind.

3,502 (480 direct, 3,022 indirect) bytes in 1 blocks are definitely lost in loss record 77 of 84
   at 0x48483F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm64-linux.so)
   by 0x5750817: ralloc_size (ralloc.c:119)
   by 0x5750977: rzalloc_size (ralloc.c:151)
   by 0x575C173: nir_shader_create (nir.c:45)
   by 0x5763ACB: nir_shader_clone (nir_clone.c:728)
   by 0x55D5003: st_create_fp_variant (st_program.c:1242)
   by 0x55D789F: st_get_fp_variant (st_program.c:1522)
   by 0x55D789F: st_get_fp_variant (st_program.c:1507)
   by 0x56400C3: st_update_fp (st_atom_shader.c:163)
   by 0x563D333: st_validate_state (st_atom.c:261)
   by 0x55D07CB: prepare_draw (st_draw.c:132)
   by 0x55D08DF: st_draw_vbo (st_draw.c:184)
   by 0x55576CB: _mesa_draw_arrays (draw.c:374)
   by 0x55576CB: _mesa_draw_arrays (draw.c:351)

Signed-off-by: Erico Nunes <nunes.erico at gmail.com>
Reviewed-by: Qiang Yu <yuq825 at gmail.com>

---

 src/gallium/drivers/lima/lima_program.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c
index 3fd7b0711a6..a057cdbdabe 100644
--- a/src/gallium/drivers/lima/lima_program.c
+++ b/src/gallium/drivers/lima/lima_program.c
@@ -380,6 +380,8 @@ lima_create_vs_state(struct pipe_context *pctx,
       return NULL;
    }
 
+   ralloc_free(nir);
+
    return so;
 }
 




More information about the mesa-commit mailing list