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

PATCH: parse_cvdef shuffle



This memory doesn't need to be allocated until after the (c == ':')
block, which could return without freeing it.

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.111
diff -u -r1.111 computil.c
--- Src/Zle/computil.c	18 Oct 2008 19:16:24 -0000	1.111
+++ Src/Zle/computil.c	29 Oct 2008 01:27:20 -0000
@@ -2905,13 +2905,6 @@
 	    zwarnnam(nam, "invalid value definition: %s", *args);
 	    return NULL;
 	}
-	if (!multi) {
-	    if (!xor) {
-		xor = (char **) zalloc(2 * sizeof(char *));
-		xor[1] = NULL;
-	    }
-	    xor[xnum] = ztrdup(name);
-	}
 	/* Get argument? */
 
 	if (c == ':') {
@@ -2930,6 +2923,13 @@
 	    vtype = CVV_NOARG;
 	    arg = NULL;
 	}
+	if (!multi) {
+	    if (!xor) {
+		xor = (char **) zalloc(2 * sizeof(char *));
+		xor[1] = NULL;
+	    }
+	    xor[xnum] = ztrdup(name);
+	}
 	*valp = val = (Cvval) zalloc(sizeof(*val));
 	valp = &((*valp)->next);
 



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