summaryrefslogtreecommitdiff
path: root/run.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2013-01-02 21:53:45 +0000
committerXin LI <delphij@FreeBSD.org>2013-01-02 21:53:45 +0000
commitc323c12cd8cea3384b83ddef0592138f8eccbe70 (patch)
treeedbe0c815ff6e60da0ddf4265407ce18f44b668f /run.c
parentb0f5e94e3f34717e78a265dc61c6c45406a258d0 (diff)
Notes
Diffstat (limited to 'run.c')
-rw-r--r--run.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/run.c b/run.c
index 553081f0fced..6c4ce10a2eeb 100644
--- a/run.c
+++ b/run.c
@@ -1210,13 +1210,13 @@ Cell *dopa2(Node **a, int n) /* a[0], a[1] { a[2] } */
Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
{
Cell *x = 0, *y, *ap;
- char *s;
+ char *s, *origs;
int sep;
char *t, temp, num[50], *fs = 0;
int n, tempstat, arg3type;
y = execute(a[0]); /* source string */
- s = getsval(y);
+ origs = s = strdup(getsval(y));
arg3type = ptoi(a[3]);
if (a[2] == 0) /* fs string */
fs = *FS;
@@ -1336,6 +1336,7 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
}
tempfree(ap);
tempfree(y);
+ free(origs);
if (a[2] != 0 && arg3type == STRING) {
tempfree(x);
}