gawk/gawk-4.1.1-eval_invalid_fre...

36 lines
973 B
Diff

From 1ce114185c83a5c711a791da42e46dad77b4fa34 Mon Sep 17 00:00:00 2001
From: jchaloup <jchaloup@redhat.com>
Date: Tue, 13 May 2014 09:28:46 +0200
Subject: [PATCH] eval invalid free
---
debug.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/debug.c b/debug.c
index b55f357..0b6e992 100644
--- a/debug.c
+++ b/debug.c
@@ -5565,8 +5565,16 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
pop_context(); /* switch to prev context */
free_context(ctxt, (ret_val != NULL)); /* free all instructions and optionally symbols */
- if (ret_val != NULL)
- destroy_symbol(f); /* destroy "@eval" */
+ if (ret_val != NULL) {
+ /*
+ * Remove @eval from FUNCTAB, so that above code
+ * will work the next time around.
+ */
+ NODE *s = make_string("@eval", 5);
+
+ (void) assoc_remove(func_table, s);
+ unref(s);
+ }
return false;
}
--
1.9.0