summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-03-27 19:23:36 -0700
committerKenneth Graunke <[email protected]>2015-04-02 14:20:00 -0700
commit587b3a20a1d3201467adf90e66b53b9843b2cc0a (patch)
tree77649c9be6db59b3c64053e526928cb262db667b /src/glsl/nir/nir.c
parentf61b6c3e48071991c098aa588ee86473f419d5c0 (diff)
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]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r--src/glsl/nir/nir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 6459d510826..0311d8d27f0 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;