summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-09-20 14:02:29 -0400
committerRob Clark <[email protected]>2015-09-20 14:04:06 -0400
commitb65f91dd3285ca0daee658cdf9ac41caaad2f1fb (patch)
tree34677d5d0b8195a3b3341ec98893db9f26afd5d9
parent6ba291db4ba4f03ac94560eaae861bc162ac838e (diff)
nir/print: fix coverity error
Not something actually hit in real life (now state is never non-null, but only case state->syms is null is if nir_print_instr() path). But it was something I overlooked the first time, so might as well fix it. *** CID 1324642: Null pointer dereferences (REVERSE_INULL) /src/glsl/nir/nir_print.c: 299 in print_var_decl() 293 294 fprintf(fp, " (%s, %u)", loc, var->data.driver_location); 295 } 296 297 fprintf(fp, "\n"); 298 >>> CID 1324642: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "state" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 299 if (state) { 300 _mesa_set_add(state->syms, name); 301 _mesa_hash_table_insert(state->ht, var, name); 302 } 303 } 304 Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/glsl/nir/nir_print.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
index 6e86140ed9d..a19aa8b9132 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -296,7 +296,7 @@ print_var_decl(nir_variable *var, print_state *state)
fprintf(fp, "\n");
- if (state) {
+ if (state->syms) {
_mesa_set_add(state->syms, name);
_mesa_hash_table_insert(state->ht, var, name);
}