glsl: avoid accessing invalid memory after get_variable_being_redeclared()
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 13 Sep 2017 07:34:38 +0000 (09:34 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 14 Sep 2017 09:23:26 +0000 (11:23 +0200)
commit98141366f907ee35c8436eee8fd2d6fa56759bf8
tree2fd0447abecff703d1ce3db90b363d92e801a872
parenta7017746d77f33cb60af20c9fcefeb0e6ac89fd4
glsl: avoid accessing invalid memory after get_variable_being_redeclared()

After get_variable_being_redeclared() has been called, it is no longer
safe to access the original variable pointer, since its memory might have
been freed.

Since callers of this function should only be accessing the variable pointer
returned by the function, avoid potential bugs by re-assigning the
original variable pointer to the result of the function call,
making it impossible for the remaining code to access an invalid variable
pointer.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/glsl/ast_to_hir.cpp