glsl: fix use-after free bug/crash in ast_declarator_list::hir()
authorBrian Paul <brianp@vmware.com>
Fri, 23 May 2014 20:59:33 +0000 (14:59 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 28 May 2014 21:06:07 +0000 (15:06 -0600)
commitf9cecca7a6e3d9ff231075381b88d179e153a5a4
tree51a054b9e24579eb1aa36f4a304541d57d044cd8
parentbb9623a1a8b1884817422752c8dced9f084d4547
glsl: fix use-after free bug/crash in ast_declarator_list::hir()

The call to get_variable_being_redeclared() may delete 'var' so we
can't reference var->name afterward.  We fix that by examining the
var's name before making that call.

Fixes valgrind warnings and possible crash when running the piglit
tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test
test (and probably others).

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp