about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2008-11-06 02:59:42 +0000
committerClint Adams <clint@users.sourceforge.net>2008-11-06 02:59:42 +0000
commit3fc22d6eab216376e354fac5cbbd83170486430d (patch)
tree4787d44b99c551175ffcd739132c1f6b5c6c5285
parentcbc24017fef38963fb1ccbbe3aeb57b5dfdb92a2 (diff)
downloadzsh-3fc22d6eab216376e354fac5cbbd83170486430d.tar.gz
zsh-3fc22d6eab216376e354fac5cbbd83170486430d.tar.xz
zsh-3fc22d6eab216376e354fac5cbbd83170486430d.zip
26014: don't allocate and leak a patprog if it's not going to be used.
-rw-r--r--ChangeLog3
-rw-r--r--Src/glob.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7593e90a8..c9976ab8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-11-06  Clint Adams  <clint@zsh.org>
 
+	* 26014: Src/glob.c: don't allocate and leak a patprog if it's not
+	going to be used.
+
 	* 26013: Src/Modules/tcp.c: don't ztrdup the other buffer returned
 	by inet_ntoa.  cf. 25987.
 
diff --git a/Src/glob.c b/Src/glob.c
index f8d7b5ad0..ce7de1ed6 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -693,11 +693,13 @@ parsecomplist(char *instr)
     if (*(str = instr) == Inpar && !skipparens(Inpar, Outpar, (char **)&str) &&
         *str == Pound && isset(EXTENDEDGLOB) && str[-2] == '/') {
 	instr++;
-	if (!(p1 = patcompile(instr, compflags, &instr)))
-	    return NULL;
+
 	if (instr[0] == '/' && instr[1] == Outpar && instr[2] == Pound) {
 	    int pdflag = 0;
 
+	    if (!(p1 = patcompile(instr, compflags, &instr)))
+	        return NULL;
+
 	    instr += 3;
 	    if (*instr == Pound) {
 		pdflag = 1;