diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2010-09-08 20:07:26 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-09-08 20:07:26 +0800 |
commit | f42e443bb511ed3224f09b4fcf0772438ebdbbfa (patch) | |
tree | fc2523d1f399d4d4a8a6432e3855de649ddf7346 /src/expand.h | |
parent | [JOBS] Debug compile fix (diff) | |
download | dash-f42e443bb511ed3224f09b4fcf0772438ebdbbfa.tar.gz dash-f42e443bb511ed3224f09b4fcf0772438ebdbbfa.zip |
[EXPAND] Fix ifsfirst/ifslastp leak
As it stands expandarg may return with a non-NULL ifslastp which then confuses any subsequent ifsbreakup user that doesn't clear it directly. What's worse, if we get interrupted before we hit ifsfree in expandarg we will leak memory. This patch fixes this by always calling ifsfree in expandarg thus ensuring that ifslastp is always NULL on the normal path. It also adds an ifsfree call to the RESET path to ensure that memory isn't leaked. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/expand.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/expand.h b/src/expand.h index 405af0b..4251a4a 100644 --- a/src/expand.h +++ b/src/expand.h @@ -70,6 +70,7 @@ int casematch(union node *, char *); void recordregion(int, int, int); void removerecordregions(int); void ifsbreakup(char *, struct arglist *); +void ifsfree(void); /* From arith.y */ intmax_t arith(const char *); |