aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xChangeLog5
-rw-r--r--builtin.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f04e8ab..da93370e 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * builtin.c (do_typeof): Fix memory leak when populating the
+ optional array, and make sure to call the astore method.
+
2019-01-09 Andrew J. Schorr <aschorr@telemetry-investments.com>
* awkgram.y (tokentab): Indicate that typeof may take 2 arguments.
diff --git a/builtin.c b/builtin.c
index c92a5982..9cf817ac 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4090,6 +4090,9 @@ do_typeof(int nargs)
NODE **lhs = assoc_lookup(dbg, sub);
unref(*lhs);
*lhs = make_string(arg->array_funcs->name, strlen(arg->array_funcs->name));
+ if (dbg->astore != NULL)
+ (*dbg->astore)(dbg, sub);
+ unref(sub);
}
break;
case Node_val:
@@ -4125,6 +4128,9 @@ do_typeof(int nargs)
NODE **lhs = assoc_lookup(dbg, sub);
unref(*lhs);
*lhs = make_string(s, strlen(s));
+ if (dbg->astore != NULL)
+ (*dbg->astore)(dbg, sub);
+ unref(sub);
}
break;
case Node_var_new: