nir: Allocate nir_call_instr::params out of the nir_call itself.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 7 Apr 2015 07:32:55 +0000 (00:32 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 7 Apr 2015 21:34:13 +0000 (14:34 -0700)
The lifetime of the params array needs to be match the nir_call_instr
itself.  So, allocate it using the instruction itself as the context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/nir/nir.c

index 5f86ecaa202949d0b86774379a99d8be83df133c..0f807ddcccff6045a737a37d6e6b21cd8c11f70e 100644 (file)
@@ -445,7 +445,7 @@ nir_call_instr_create(void *mem_ctx, nir_function_overload *callee)
 
    instr->callee = callee;
    instr->num_params = callee->num_params;
-   instr->params = ralloc_array(mem_ctx, nir_deref_var *, instr->num_params);
+   instr->params = ralloc_array(instr, nir_deref_var *, instr->num_params);
    instr->return_deref = NULL;
 
    return instr;