comparison 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
comparison
equal deleted inserted replaced
13969:3b5afcec526b 13970:c93b953f7d54
569 569
570 if (retval == 0) 570 if (retval == 0)
571 { 571 {
572 if (global_command) 572 if (global_command)
573 { 573 {
574 // Use an unwind-protect cleanup function so that the
575 // global_command list will be deleted in the event of
576 // an interrupt.
577
578 frame.add_fcn (cleanup_statement_list, &global_command);
579
574 global_command->accept (*current_evaluator); 580 global_command->accept (*current_evaluator);
575
576 delete global_command;
577
578 global_command = 0;
579 581
580 octave_quit (); 582 octave_quit ();
581 583
582 if (! (interactive || forced_interactive)) 584 if (! (interactive || forced_interactive))
583 { 585 {