summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorMatthias Lederhofer <matled@gmx.net>2006-07-14 16:37:06 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-14 18:32:39 (GMT)
commitd5b9e6cfa7a20932ca17649c9172619c9d961db4 (patch)
treecaf5179b02c212fc6dca478b7540a29676bf0da9 /git.c
parentdd4c59121ff8277d49a64a8f105936878a9fd7af (diff)
downloadgit-d5b9e6cfa7a20932ca17649c9172619c9d961db4.zip
git-d5b9e6cfa7a20932ca17649c9172619c9d961db4.tar.gz
git-d5b9e6cfa7a20932ca17649c9172619c9d961db4.tar.bz2
argv created by handle_alias should be NULL terminated
Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git.c')
-rw-r--r--git.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/git.c b/git.c
index 102735a..ee5a0e8 100644
--- a/git.c
+++ b/git.c
@@ -133,13 +133,12 @@ static int handle_alias(int *argcp, const char ***argv)
fflush(stderr);
}
+ new_argv = realloc(new_argv, sizeof(char*) *
+ (count + *argcp + 1));
/* insert after command name */
- if (*argcp > 1) {
- new_argv = realloc(new_argv, sizeof(char*) *
- (count + *argcp));
- memcpy(new_argv + count, *argv + 1,
- sizeof(char*) * *argcp);
- }
+ memcpy(new_argv + count, *argv + 1,
+ sizeof(char*) * *argcp);
+ new_argv[count+*argcp] = NULL;
*argv = new_argv;
*argcp += count - 1;