aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2010-11-28 21:09:51 +0800
committermaximilian attems <max@stro.at>2011-06-03 18:44:13 +0200
commit81a27359732b3ef3ff65c401490b17fc76983031 (patch)
treee6bf14ced26ca66eab3cbbf659a1d581df0bc588
parented7b1cc8058abb9cb3c41755421a2bd27ecb8987 (diff)
downloadklibc-81a27359732b3ef3ff65c401490b17fc76983031.tar.gz
[klibc] [EXPAND] Free IFS state in evalbackcmd
On Sun, Nov 07, 2010 at 04:04:20PM -0600, Jonathan Nieder wrote: > > Herbert Xu wrote: > > > commit f42e443bb511ed3224f09b4fcf0772438ebdbbfa > > Author: Herbert Xu <herbert@gondor.apana.org.au> > > Date: Wed Sep 8 20:07:26 2010 +0800 > > > > [EXPAND] Fix ifsfirst/ifslastp leak > > Another puzzle bisecting to f42e443bb. This one comes from the > grub-mkconfig script: > > $ sh -c 'datadir=/usr/share; pkgdatadir=${datadir}/`cat`' 2>&1 | cat -A > cat: M-^\^M^F^HM-4^M^F^HM-(^M^F^H: No such file or directory$ > cat: M-(^M^F^H: No such file or directory$ > > Still reproducible with 016b529. I'll try to find time to look into > it, but thought you might like to know nevertheless. This is the symptom of another leak. In this case evalbackcmd occurs in the middle of an expansion (as it should) but the forked child never clears the previous IFS state. This patch adds the missing ifsfree call. This wasn't as much of a problem as the previously discovered leaks since all it means is that the child gets to carry around the parent's expansion state and the child is usually short-lived. Reported-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/dash/eval.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 3866a4a3a238e3..2fd326da711dca 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -625,6 +625,7 @@ evalbackcmd(union node *n, struct backcmd *result)
dup2(pip[1], 1);
close(pip[1]);
}
+ ifsfree();
evaltreenr(n, EV_EXIT);
/* NOTREACHED */
}