# HG changeset patch # User John W. Eaton # Date 1381496754 14400 # Node ID 1e8f8900a041277201a9d45901042e5d17c78241 # Parent 99ffa521ecec47c07f9d2f091c19c9ba797ceea5 clean up partially constructed parse tree objects on parse errors (bug #40231) * oct-parse.in.yy (%destructor): New declaration of cleanup actions to take for items on the parser stack when a parse error occurs. diff -r 99ffa521ecec -r 1e8f8900a041 libinterp/parse-tree/oct-parse.in.yy --- a/libinterp/parse-tree/oct-parse.in.yy Fri Oct 11 14:12:37 2013 +0200 +++ b/libinterp/parse-tree/oct-parse.in.yy Fri Oct 11 09:05:54 2013 -0400 @@ -298,6 +298,13 @@ %right PLUS_PLUS MINUS_MINUS %left '(' '.' '{' +// How to clean up if there is a parse error. We handle deleting tokens +// and comments seperately and separators are just characters. The +// remaining items are dynamically allocated parse tree objects that +// must be deleted. +%destructor { } <> +%destructor { delete $$; } <*> + // Where to start. %start input