changeset 21740:767c81fe30ba

Fix memory bug in source() from cset 4c080cbc4ef9 (bug #47938) * parse.in.yy (source_file): Delete fcn if it does *not* come from the symbol table, instead of if it does.
author Lachlan Andrew <lachlanbis@gmail.com>
date Thu, 19 May 2016 22:08:42 +1000
parents c4ab2e54f100
children 71d8a9a0642c
files libinterp/parse-tree/oct-parse.in.yy
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Thu May 19 01:59:35 2016 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Thu May 19 22:08:42 2016 +1000
@@ -4617,10 +4617,11 @@
       if (fcn)
         {
           if (octave::sys::canonicalize_file_name (fcn->fcn_file_name ())
-              == full_name)
-            delete_fcn = true;
-          else
-            fcn = 0;             // wrong file, so load it below
+              != full_name)
+            {
+              fcn = 0;             // wrong file, so load it below
+              delete_fcn = true;   // and delete it when done.
+            }
         }
     }