aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Janda <felix.janda@posteo.de>2012-12-30 11:53:27 +0100
committerFelix Janda <felix.janda@posteo.de>2012-12-30 11:53:27 +0100
commit5e9d8657675a79b17f00e625749214e79bf116a1 (patch)
tree4a4840cbb32eb09877a6f5c5b0443011b03224bb
parent90c6dfa16cff8a70f27a867c3d97f6968384f755 (diff)
downloadtoybox-5e9d8657675a79b17f00e625749214e79bf116a1.tar.gz
Fix invalid free in toysh.
-rw-r--r--toys/posix/sh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/sh.c b/toys/posix/sh.c
index 32d05ec2..2f09f63b 100644
--- a/toys/posix/sh.c
+++ b/toys/posix/sh.c
@@ -305,7 +305,7 @@ static void run_pipeline(struct pipeline *line)
tl->toy_main();
}
cmd->pid = toys.exitval;
- free(toys.optargs);
+ if (toys.optargs != toys.argv+1) free(toys.optargs);
if (toys.old_umask) umask(toys.old_umask);
memcpy(&toys, &temp, sizeof(struct toy_context));
} else {