changeset 17673:9f6e4e5c2bac

avoid memory leak in parser (bug #40231) * oct-parse.in.yy (octave_base_parser::make_try_command): If an an error identifier is extracted from the list of cleanup statements, delete the first statement from the list.
author John W. Eaton <jwe@octave.org>
date Thu, 17 Oct 2013 12:32:28 -0400
parents 36917b3db6b2
children dd125b5e8090
files libinterp/parse-tree/oct-parse.in.yy
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Thu Oct 17 09:11:24 2013 -0700
+++ b/libinterp/parse-tree/oct-parse.in.yy	Thu Oct 17 12:32:28 2013 -0400
@@ -2390,6 +2390,9 @@
                   id = dynamic_cast<tree_identifier *> (expr);
 
                   cleanup_stmts->pop_front ();
+
+                  stmt->set_expression (0);
+                  delete stmt;
                 }
             }
         }