Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: memory leak in parsecomplist



No point in allocating p1 if it's not going to be used.  CID 74.

Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.66
diff -u -r1.66 glob.c
--- Src/glob.c	29 Sep 2008 08:46:33 -0000	1.66
+++ Src/glob.c	6 Nov 2008 02:54:36 -0000
@@ -693,11 +693,13 @@
     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;



Messages sorted by: Reverse Date, Date, Thread, Author