summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/computil.c14
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 67e57fa59..e4a77bf82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-29  Clint Adams  <clint@zsh.org>
+
+	* 25940: Src/Zle/computil.c: delay !multi memory allocation until
+	after possibility to error out and return without freeing.
+
 2008-10-28  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 25938 (Mikael) + probably 25939, too:
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index e70a05f1a..056a611ac 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2905,13 +2905,6 @@ parse_cvdef(char *nam, char **args)
 	    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 @@ parse_cvdef(char *nam, char **args)
 	    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);