summaryrefslogtreecommitdiff
path: root/alias.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-23 01:39:08 -0700
committerJunio C Hamano <gitster@pobox.com>2009-05-23 01:39:08 -0700
commit2beba6beb0074afac988594539572865fb37a00f (patch)
tree9b4d4d1aa1b0d9c95aeb8c382156cb7fcb71bee9 /alias.c
parent15d29dde04842d0222cfbc0a8383382ccff9ec21 (diff)
parent27d5438d9f4eb2cefc2a989c68f9b42b529b2a12 (diff)
downloadgit-2beba6beb0074afac988594539572865fb37a00f.tar.gz
Merge branch 'jk/maint-1.6.0-trace-argv'
* jk/maint-1.6.0-trace-argv: fix GIT_TRACE segfault with shell-quoted aliases Conflicts: alias.c
Diffstat (limited to 'alias.c')
-rw-r--r--alias.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/alias.c b/alias.c
index e687fe54c1..372b7d8093 100644
--- a/alias.c
+++ b/alias.c
@@ -38,10 +38,7 @@ int split_cmdline(char *cmdline, const char ***argv)
while (cmdline[++src]
&& isspace(cmdline[src]))
; /* skip */
- if (count >= size) {
- size += 16;
- *argv = xrealloc(*argv, sizeof(char *) * size);
- }
+ ALLOC_GROW(*argv, count+1, size);
(*argv)[count++] = cmdline + dst;
} else if (!quoted && (c == '\'' || c == '"')) {
quoted = c;
@@ -72,6 +69,9 @@ int split_cmdline(char *cmdline, const char ***argv)
return error("unclosed quote");
}
+ ALLOC_GROW(*argv, count+1, size);
+ (*argv)[count] = NULL;
+
return count;
}