aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-11-26 20:41:52 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-11-26 20:41:52 +0200
commitb3388ecca941bbd76ecca9413c78295c97b9013c (patch)
treea2b878d9e9abfd29d1f9650ff0dac216195d27ab /debug.c
parentcedf898bfd8d45a028d087a512fe7c1c789ee6dc (diff)
parenta42eaf5184b2d5e0628bb6afac61745bde138ee4 (diff)
downloadegawk-b3388ecca941bbd76ecca9413c78295c97b9013c.tar.gz
egawk-b3388ecca941bbd76ecca9413c78295c97b9013c.tar.bz2
egawk-b3388ecca941bbd76ecca9413c78295c97b9013c.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/debug.c b/debug.c
index 9a022669..3e76ae61 100644
--- a/debug.c
+++ b/debug.c
@@ -1299,10 +1299,11 @@ do_set_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
arg = arg->next;
val = arg->a_node;
lhs = get_field(field_num, &assign);
- unref(*lhs);
- *lhs = dupnode(val);
if (assign)
+ /* call assign to copy fields before unref frees $0 */
assign();
+ unref(*lhs);
+ *lhs = dupnode(val);
print_field(field_num);
}
break;