zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: parse_cvdef shuffle
@ 2008-10-29  1:30 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2008-10-29  1:30 UTC (permalink / raw)
  To: zsh-workers

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);
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-29  1:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-29  1:30 PATCH: parse_cvdef shuffle Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).