From 6b33894f9973185135a5ddd7d665c56bf5ca9a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 24 Dec 2014 01:18:31 +0100 Subject: transport: simplify duplicating a substring in transport_get() using xmemdupz() Signed-off-by: Rene Scharfe Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/transport.c b/transport.c index 70d38e4c4b..08bcd3a4eb 100644 --- a/transport.c +++ b/transport.c @@ -971,9 +971,7 @@ struct transport *transport_get(struct remote *remote, const char *url) } else { /* Unknown protocol in URL. Pass to external handler. */ int len = external_specification_len(url); - char *handler = xmalloc(len + 1); - handler[len] = 0; - strncpy(handler, url, len); + char *handler = xmemdupz(url, len); transport_helper_init(ret, handler); } -- cgit v1.2.1