Mercurial > octave-antonio
changeset 17618:77eff9c6fb09
avoid memory leak when parsing function files (bug #40218)
* oct-parse.in.yy (file): Delete opt_list if parsing a function file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 09 Oct 2013 13:53:12 -0400 |
parents | 9abb1422d60b |
children | 4288b90f18c4 |
files | libinterp/parse-tree/oct-parse.in.yy |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy Wed Oct 09 17:33:50 2013 +0200 +++ b/libinterp/parse-tree/oct-parse.in.yy Wed Oct 09 13:53:12 2013 -0400 @@ -1126,7 +1126,17 @@ file : INPUT_FILE opt_nl opt_list END_OF_INPUT { - if (! lexer.reading_fcn_file) + if (lexer.reading_fcn_file) + { + // Delete the dummy statement_list we created + // after parsing the function. Any function + // definitions found in the file have already + // been stored in the symbol table or in + // octave_base_parser::primary_fcn_ptr. + + delete $3; + } + else { tree_statement *end_of_script = parser.make_end ("endscript", true,