aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-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 {