From 61ebc01dfecda0963a184e881ea966e2d92f0519 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 18:02:12 -0700 Subject: glcpp: Fix use-after-free error from #undef directive. By taking advantage of the recently-added hash_table_remove function. With this change, all existing tests are now valgrind-clean. --- src/glsl/glcpp/glcpp-parse.y | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/glsl/glcpp') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e5544fe29b8..a2b54eff507 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -202,10 +202,7 @@ control_line: | HASH_UNDEF IDENTIFIER NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); if (macro) { - /* XXX: Need hash table to support a real way - * to remove an element rather than prefixing - * a new node with data of NULL like this. */ - hash_table_insert (parser->defines, NULL, $2); + hash_table_remove (parser->defines, $2); talloc_free (macro); } talloc_free ($2); -- cgit v1.2.3