aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/debug.c b/debug.c
index 7dff7b8d..a69b7e3e 100644
--- a/debug.c
+++ b/debug.c
@@ -1263,7 +1263,9 @@ do_set_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
array = make_array();
array->vname = estrdup(subs->stptr, subs->stlen);
array->parent_array = r;
- *assoc_lookup(r, subs) = array;
+ lhs = assoc_lookup(r, subs);
+ unref(*lhs);
+ *lhs = array;
r = array;
} else if (value->type != Node_var_array) {
d_error(_("attempt to use scalar `%s[\"%s\"]' as array"),