From 32716a2c6c238113c9a5af116e5ab6f3f4ecde8d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 21 Nov 2008 01:44:59 +0100 Subject: [PATCH] builtin-clone: use strbuf in guess_dir_name() Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- builtin-clone.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin-clone.c b/builtin-clone.c index 8e1a1d399..275b690b3 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -134,9 +134,9 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare) } if (is_bare) { - char *result = xmalloc(end - start + 5); - sprintf(result, "%.*s.git", (int)(end - start), start); - return result; + struct strbuf result = STRBUF_INIT; + strbuf_addf(&result, "%.*s.git", (int)(end - start), start); + return strbuf_detach(&result, 0); } return xstrndup(start, end - start); -- 2.26.2