summaryrefslogtreecommitdiff
path: root/src/symlist.c
diff options
context:
space:
mode:
authorAkim Demaille <demaille@gostai.com>2011-03-02 17:06:58 +0100
committerAkim Demaille <demaille@gostai.com>2011-03-09 21:04:17 +0100
commit8f462efe923947cc4e72deea5b0fa93a5f88000d (patch)
tree099cfd251d6d026415b42caeba4a61f0b545b291 /src/symlist.c
parent686e83e396696572171fad32f440cc279ab82a75 (diff)
downloadbison-8f462efe923947cc4e72deea5b0fa93a5f88000d.tar.gz
named references: fix double free.
In `rhs[name]: "a" | "b"', do not free "name" twice. Reported by Tys Lefering. <http://lists.gnu.org/archive/html/bug-bison/2010-06/msg00002.html> * src/named-ref.h, src/named-ref.c (named_ref_copy): New. * src/parse-gram.y (current_lhs): Rename as... (current_lhs_symbol): this. (current_lhs): New function. Use it to free the current lhs named reference. * src/reader.c: Bind lhs to a copy of the current named reference. * src/symlist.c: Rely on free (0) being valid. * tests/named-refs.at: Test this.
Diffstat (limited to 'src/symlist.c')
-rw-r--r--src/symlist.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/symlist.c b/src/symlist.c
index e717c3e1..190d0073 100644
--- a/src/symlist.c
+++ b/src/symlist.c
@@ -151,8 +151,7 @@ symbol_list_free (symbol_list *list)
for (node = list; node; node = next)
{
next = node->next;
- if (node->named_ref)
- named_ref_free (node->named_ref);
+ named_ref_free (node->named_ref);
free (node);
}
}