aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-05-09 11:42:52 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-05-09 11:42:52 +0300
commit12857707435f1d4bf9adf33b6fbfd57ff91529a7 (patch)
treef41897206773d57a9fc040785446144ab464cba4 /debug.c
parent123402fa15ec56d510ddd4cba16a5aea88e18023 (diff)
downloadegawk-12857707435f1d4bf9adf33b6fbfd57ff91529a7.tar.gz
egawk-12857707435f1d4bf9adf33b6fbfd57ff91529a7.tar.bz2
egawk-12857707435f1d4bf9adf33b6fbfd57ff91529a7.zip
Fix memory leak in do_eval.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/debug.c b/debug.c
index 1ff43bd6..32b308af 100644
--- a/debug.c
+++ b/debug.c
@@ -5448,6 +5448,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
int ecount = 0, pcount = 0;
int ret;
int save_flags = do_flags;
+ SRCFILE *the_source;
if (prog_running) {
this_frame = find_frame(0);
@@ -5458,7 +5459,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
ctxt = new_context();
ctxt->install_func = append_symbol; /* keep track of newly installed globals */
push_context(ctxt);
- (void) add_srcfile(SRC_CMDLINE, arg->a_string, srcfiles, NULL, NULL);
+ the_source = add_srcfile(SRC_CMDLINE, arg->a_string, srcfiles, NULL, NULL);
do_flags = false;
ret = parse_program(&code);
do_flags = save_flags;
@@ -5575,6 +5576,8 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
* destroy_symbol(f); // destroy "@eval"
*/
+ free_srcfile(the_source);
+
return false;
}