[Mesa-dev] [PATCH 2/6] nir: Check in register_*_instr() after null pointers
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Mon Jan 26 01:07:47 PST 2015
If _mesa_set_create() return null there is low memory.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
src/glsl/nir/nir_lower_vars_to_ssa.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c b/src/glsl/nir/nir_lower_vars_to_ssa.c
index 8af7530..0d8c9e3 100644
--- a/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -446,7 +446,8 @@ register_load_instr(nir_intrinsic_instr *load_instr,
node->loads = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- _mesa_set_add(node->loads, load_instr);
+ if (node->loads)
+ _mesa_set_add(node->loads, load_instr);
}
static void
@@ -461,7 +462,8 @@ register_store_instr(nir_intrinsic_instr *store_instr,
node->stores = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- _mesa_set_add(node->stores, store_instr);
+ if (node->stores)
+ _mesa_set_add(node->stores, store_instr);
}
static void
@@ -479,7 +481,8 @@ register_copy_instr(nir_intrinsic_instr *copy_instr,
node->copies = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- _mesa_set_add(node->copies, copy_instr);
+ if (node->copies)
+ _mesa_set_add(node->copies, copy_instr);
}
}
--
1.8.5.1
More information about the mesa-dev
mailing list