Mesa (master): nir/sweep: Reparent the shader name

Jason Ekstrand jekstrand at kemper.freedesktop.org
Thu Oct 8 15:20:52 UTC 2015


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Mon Oct  5 17:16:02 2015 -0700

nir/sweep: Reparent the shader name

Previously the name of the nir shader was being freed prematurely during
nir_sweep. Since 756613ed35d the name was later being used to generate
filenames for the optimiser debug output and these would end up with
garbage from the dangling pointer.

Co-authored-by: Neil Roberts <neil at linux.intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/nir/nir_sweep.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glsl/nir/nir_sweep.c b/src/glsl/nir/nir_sweep.c
index d354975..b6ce43b 100644
--- a/src/glsl/nir/nir_sweep.c
+++ b/src/glsl/nir/nir_sweep.c
@@ -154,6 +154,8 @@ nir_sweep(nir_shader *nir)
    /* First, move ownership of all the memory to a temporary context; assume dead. */
    ralloc_adopt(rubbish, nir);
 
+   ralloc_steal(nir, (char *)nir->info.name);
+
    /* Variables and registers are not dead.  Steal them back. */
    steal_list(nir, nir_variable, &nir->uniforms);
    steal_list(nir, nir_variable, &nir->inputs);




More information about the mesa-commit mailing list