changeset 23628:fca2f775ab4c

eliminate memory leak when parsing local functions in a classdef file * oct-parse.in.yy (file): Delete dummy statement list created from parsing local functions in a classdef file.
author John W. Eaton <jwe@octave.org>
date Fri, 16 Jun 2017 16:38:47 -0400
parents 0a6e87804cab
children b18805350473
files libinterp/parse-tree/oct-parse.in.yy
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Fri Jun 16 14:42:35 2017 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Fri Jun 16 16:38:47 2017 -0400
@@ -1453,7 +1453,14 @@
                   {
                     YYUSE ($2);
                     YYUSE ($5);
-                    YYUSE ($6);
+
+                    // Delete the dummy statement_list we created
+                    // after parsing the function.  Any local function
+                    // definitions found in the file have already been
+                    // stored in the symbol table or in
+                    // base_parser::primary_fcn_ptr.
+
+                    delete $6;
 
                     if (lexer.reading_classdef_file)
                       parser.classdef_object = $3;