Mercurial > hg > octave-avbm
diff src/toplev.cc @ 13970:c93b953f7d54
plug some memory leaks
* oct-parse.yy, parse.h (cleanup_statement_list): New function.
* toplev.cc (main_loop): Put cleanup_statement_list on the
unwind_protect stack to delete the command list created by the
parser instead of deleting it directly.
* oct-parse.yy (parse_fcn_file, eval_string): Likewise.
* input.cc (get_debug_input): Likewise.
* pt-loop.cc (tree_simple_for_command::~tree_simple_for_command,
tree_complex_for_command::~tree_complex_for_command):
Also delete lhs expression.
* pt-idx.cc (tree_index_expression::~tree_index_expression):
Also delete contents of dyn_field list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 01 Dec 2011 04:26:46 -0500 |
parents | 6b0798860fa4 |
children | 2c664266e9d0 |
line wrap: on
line diff
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -571,11 +571,13 @@ { if (global_command) { - global_command->accept (*current_evaluator); + // Use an unwind-protect cleanup function so that the + // global_command list will be deleted in the event of + // an interrupt. - delete global_command; + frame.add_fcn (cleanup_statement_list, &global_command); - global_command = 0; + global_command->accept (*current_evaluator); octave_quit ();