diff options
author | Carl Worth <cworth@cworth.org> | 2010-07-19 18:02:12 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-07-20 14:30:47 -0700 |
commit | a2a6e63e6fd0d1feb2af7af79404860ab92c47de (patch) | |
tree | f9be889357ea91dcf71471eff111e131d29ab331 | |
parent | d977c98365b4501ebadc0811928b78481e432440 (diff) |
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.
-rw-r--r-- | src/glsl/glcpp/glcpp-parse.y | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e5544fe29b..a2b54eff50 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); |