diff libinterp/corefcn/interpreter.cc @ 23630:8a47d4735655

avoid memory leak in interpreter * interpreter.h, interpreter.cc (interpreter::m_evaluator): Don't declare as a pointer. Change all uses. * call-stack.h, call-stack.cc: Don't include interpreter.h here. Move function definitions from header to source file as needed.
author John W. Eaton <jwe@octave.org>
date Fri, 16 Jun 2017 18:21:47 -0400
parents 0a6e87804cab
children 5c6cceef132b
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Fri Jun 16 18:16:17 2017 -0400
+++ b/libinterp/corefcn/interpreter.cc	Fri Jun 16 18:21:47 2017 -0400
@@ -376,7 +376,7 @@
       m_dynamic_loader (*this),
       m_load_path (),
       m_symbol_table (),
-      m_evaluator (new tree_evaluator (*this)),
+      m_evaluator (*this),
       m_interactive (false),
       m_read_site_files (true),
       m_read_init_files (m_app_context != 0),
@@ -966,7 +966,7 @@
               {
                 if (parser.stmt_list)
                   {
-                    parser.stmt_list->accept (*m_evaluator);
+                    parser.stmt_list->accept (m_evaluator);
 
                     octave_quit ();
 
@@ -1163,7 +1163,7 @@
 
   tree_evaluator& interpreter::get_evaluator (void)
   {
-    return *m_evaluator;
+    return m_evaluator;
   }
 
   symbol_table::scope *
@@ -1185,7 +1185,7 @@
 
   call_stack& interpreter::get_call_stack (void)
   {
-    return m_evaluator->get_call_stack ();
+    return m_evaluator.get_call_stack ();
   }
 
   void interpreter::recover_from_exception (void)