glsl: fix heap-use-after-free in ast_declarator_list::hir()
glsl: fix heap-use-after-free in ast_declarator_list::hir()

The get_variable_being_redeclared() function can free 'var' because
a re-declaration of an unsized array variable can establish the size, so
we set the array type to the 'earlier' declaration and free 'var' as it is
not needed anymore.

However, the same 'var' is referenced later in ast_declarator_list::hir().

This patch fixes it by picking the ir_variable_mode from the proper
ir_variable.

This error was detected by Address Sanitizer.

Signed-off-by: Samuel Iglesias Gonsálvez <b753b212f30aed827c3eea2e437609dc37310153@igalia.com>
Suggested-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99677
Cc: "17.0" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Cc: "13.0" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>

metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler