summaryrefslogtreecommitdiff
path: root/sys/src/cmd/awk
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-12-10 07:20:00 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-12-10 07:20:00 +0100
commit6e4554b7d503404f5af8da020de1125c69a20ce8 (patch)
tree04ee12364c91feeacc7bdc7382f30c729616e751 /sys/src/cmd/awk
parentdfd5bca48ed443423c4007d7ff1380898f84dd0a (diff)
awk: prevent split(a[x], a) from freeing a[x]
the freesymtab() call frees the y argument. temporarily mark it not to be freed.
Diffstat (limited to 'sys/src/cmd/awk')
-rw-r--r--sys/src/cmd/awk/run.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/src/cmd/awk/run.c b/sys/src/cmd/awk/run.c
index 5f094629e..86498f197 100644
--- a/sys/src/cmd/awk/run.c
+++ b/sys/src/cmd/awk/run.c
@@ -1213,7 +1213,9 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
FATAL("illegal type of split");
sep = *fs;
ap = execute(a[1]); /* array name */
+ y->tval |= DONTFREE; /* split(a[x], a); */
freesymtab(ap);
+ y->tval &= ~DONTFREE;
dprintf( ("split: s=|%s|, a=%s, sep=|%s|\n", s, ap->nval, fs) );
ap->tval &= ~STR;
ap->tval |= ARR;