Browse Source

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>
maint
Jeff King 15 years ago committed by Junio C Hamano
parent
commit
7b48c17093
  1. 2
      builtin-push.c

2
builtin-push.c

@ -52,7 +52,7 @@ static void set_refspecs(const char **refs, int nr) @@ -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…
Cancel
Save