fix off-by-one allocation error
Caught by valgrind in t5516. Reading the code shows we malloc enough for our string, but not trailing NUL. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
dace5dd141
commit
7b48c17093
@ -52,7 +52,7 @@ static void set_refspecs(const char **refs, int nr)
|
||||
} else if (deleterefs && !strchr(ref, ':')) {
|
||||
char *delref;
|
||||
int len = strlen(ref)+1;
|
||||
delref = xmalloc(len);
|
||||
delref = xmalloc(len+1);
|
||||
strcpy(delref, ":");
|
||||
strcat(delref, ref);
|
||||
ref = delref;
|
||||
|
Loading…
Reference in New Issue
Block a user