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

Author: Kenneth Graunke <[email protected]>
Date:   Fri Mar 27 19:23:36 2015 -0700

nir: Make nir_create_function() strdup the function name.

glsl_to_nir passes in the ir_function's name field; we were copying the
pointer, but not duplicating the memory.

We want to be able to free the linked GLSL IR program after translating
to NIR, so we'll need to create a copy of the function name that the NIR
shader actually owns.

Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>

---

 src/glsl/nir/nir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 6459d51..0311d8d 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -108,7 +108,7 @@ nir_function_create(nir_shader *shader, const char *name)
 
    exec_list_push_tail(&shader->functions, &func->node);
    exec_list_make_empty(&func->overload_list);
-   func->name = name;
+   func->name = ralloc_strdup(func, name);
    func->shader = shader;
 
    return func;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to