summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-10-01 12:12:38 +0200
committerIago Toral Quiroga <[email protected]>2014-10-02 15:39:05 +0200
commitdb8cd4d519d8b4cb2c05901e4f1a80a41ae67b2b (patch)
tree95d95ee3945d55dc1a833c2635778af2098cf06d /src/glsl/builtin_functions.cpp
parentf4b4ae8c241943b8ca65e7a00f272fe23ed73727 (diff)
glsl: Fix memory leak in builtin_builder::_image_prototype.
in_var calls the ir_variable constructor, which dups the variable name. Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl/builtin_functions.cpp')
-rw-r--r--src/glsl/builtin_functions.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 5a024cb4386..7d61fcc3561 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -4465,9 +4465,11 @@ builtin_builder::_image_prototype(const glsl_type *image_type,
sig->parameters.push_tail(in_var(glsl_type::int_type, "sample"));
/* Data arguments. */
- for (unsigned i = 0; i < num_arguments; ++i)
- sig->parameters.push_tail(in_var(data_type,
- ralloc_asprintf(NULL, "arg%d", i)));
+ for (unsigned i = 0; i < num_arguments; ++i) {
+ char *arg_name = ralloc_asprintf(NULL, "arg%d", i);
+ sig->parameters.push_tail(in_var(data_type, arg_name));
+ ralloc_free(arg_name);
+ }
/* Set the maximal set of qualifiers allowed for this image
* built-in. Function calls with arguments having fewer