Mesa (master): nir: Allocate nir_call_instr:: params out of the nir_call itself.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Apr 7 21:35:38 UTC 2015


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Apr  7 00:32:55 2015 -0700

nir: Allocate nir_call_instr::params out of the nir_call itself.

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 at whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

---

 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 5f86eca..0f807dd 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -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;




More information about the mesa-commit mailing list