glsl: fix possible memory leak in nir uniform linker
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 26 Feb 2020 02:21:20 +0000 (13:21 +1100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Feb 2020 23:48:46 +0000 (23:48 +0000)
Use UniformDataSlots for the context of UniformDataDefaults rather
than UniformStorage as in some cause UniformStorage may be NULL.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3992>

src/compiler/glsl/gl_nir_link_uniforms.c

index 1a6a4fc07a6b91b28c53c264a5db48b70f2c6c0a..1a09843454cbeb5aa55d43b8ed25861f6498872d 100644 (file)
@@ -55,7 +55,7 @@ nir_setup_uniform_remap_tables(struct gl_context *ctx,
    prog->data->UniformDataSlots = data;
 
    prog->data->UniformDataDefaults =
-         rzalloc_array(prog->data->UniformStorage,
+         rzalloc_array(prog->data->UniformDataSlots,
                        union gl_constant_value, prog->data->NumUniformDataSlots);
 
    unsigned data_pos = 0;