1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-30 05:40:58 +01:00

25940: delay !multi memory allocation until after possibility to error out and return without freeing.

This commit is contained in:
Clint Adams 2008-10-29 01:33:23 +00:00
parent e775b4dd66
commit 031dd01cf2
2 changed files with 12 additions and 7 deletions

View file

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