summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2008-10-29 01:33:23 +0000
committerClint Adams <clint@users.sourceforge.net>2008-10-29 01:33:23 +0000
commit031dd01cf20ef231c7f26b262ae01e81e3d6eb34 (patch)
tree78d69f29eb3eaa49190cb0a3af4d3810aa9d639e
parente775b4dd669fdd377ca054fc69e4eb0b882acc2c (diff)
downloadzsh-031dd01cf20ef231c7f26b262ae01e81e3d6eb34.tar.gz
zsh-031dd01cf20ef231c7f26b262ae01e81e3d6eb34.tar.xz
zsh-031dd01cf20ef231c7f26b262ae01e81e3d6eb34.zip
25940: delay !multi memory allocation until after possibility to error out and return without freeing.
-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);