st/mesa: fix use of uninitialized memory due to st_nir_lower_builtin
authorMarek Olšák <marek.olsak@amd.com>
Sat, 21 Mar 2020 21:54:36 +0000 (17:54 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 23 Mar 2020 20:01:31 +0000 (20:01 +0000)
reported by valgrind

Cc: 19.3 20.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4274>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4274>

src/mesa/state_tracker/st_nir_lower_builtin.c

index 13425d59619967ef00c3f052cec0b3da080f7ad7..4227ee5529a954dc1db0d1bfd0162fb608098004 100644 (file)
@@ -138,7 +138,7 @@ get_variable(lower_builtin_state *state, nir_deref_path *path,
       nir_variable_create(shader, nir_var_uniform, glsl_vec4_type(), name);
 
    var->num_state_slots = 1;
-   var->state_slots = ralloc_array(var, nir_state_slot, 1);
+   var->state_slots = rzalloc_array(var, nir_state_slot, 1);
    memcpy(var->state_slots[0].tokens, tokens,
           sizeof(var->state_slots[0].tokens));