aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-04-28 03:07:49 -0500
committerRob Landley <rob@landley.net>2021-04-28 03:07:49 -0500
commit137ab99aa35a94ad1519b294906522ce108e3451 (patch)
treef8ffc29ec939dff7aa4c9df11359763864b5e8be /toys
parentda735a2052f64cd53a8b79596946ee187cc58a81 (diff)
downloadtoybox-137ab99aa35a94ad1519b294906522ce108e3451.tar.gz
Toysh don't free function arguments before function returns.
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/sh.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index d0e73dc8..3ae66f62 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -2327,6 +2327,10 @@ static struct sh_process *run_command(void)
// Create new function context to hold local vars?
if (funk != TT.funcslen || (envlen && pp->arg.c) || TT.ff->blk->pipe) {
call_function();
+ if (funk != TT.funcslen) {
+ TT.ff->delete = pp->delete;
+ pp->delete = 0;
+ }
addvar(0, TT.ff); // function context (not source) so end_function deletes
locals = 1;
}