summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2010-10-18 10:55:42 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2010-10-18 10:55:42 +0800
commit016b529d2b114efc6cd91fe4e3e4767ba615870a (patch)
tree5588b6c7ee923a375c5f0922b46dea016f720e4b
parent[BUILTIN] Fix EXEXEC status clobbering (diff)
downloaddash-016b529d2b114efc6cd91fe4e3e4767ba615870a.tar.gz
dash-016b529d2b114efc6cd91fe4e3e4767ba615870a.zip
[EXPAND] Fix ifsfirst/ifslastp leak in casematch
The commit f42e443bb511ed3224f09b4fcf0772438ebdbbfa

    [EXPAND] Fix ifsfirst/ifslastp leak

revealed yet another ifsfirst/ifslastp leak in casematch.
Previously it was hidden because ifsfirst/ifslastp was cleared
unconditionally on entry (which caused the leakage of those
entries).

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--ChangeLog4
-rw-r--r--src/expand.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2faaedd..5ace9ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-18  Herbert Xu <herbert@gondor.apana.org.au>
+
+	* Fix ifsfirst/ifslastp leak in casematch.
+
 2010-10-07  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Fix EXEXEC status clobbering.
diff --git a/src/expand.c b/src/expand.c
index d6c6416..1b77b7c 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -1679,6 +1679,7 @@ casematch(union node *pattern, char *val)
 	STARTSTACKSTR(expdest);
 	argstr(pattern->narg.text, EXP_TILDE | EXP_CASE);
 	STACKSTRNUL(expdest);
+	ifsfree();
 	result = patmatch(stackblock(), val);
 	popstackmark(&smark);
 	return result;