From 7b48c170931f35c07c3ce78023519846073152a1 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 29 Jan 2010 05:31:30 -0500 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- builtin-push.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-push.c b/builtin-push.c index 5df66081a6..5633f0ade4 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -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; -- 2.11.4.GIT