1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-10 16:36:10 +02:00

transport: simplify duplicating a substring in transport_get() using xmemdupz()

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2014-12-24 01:18:31 +01:00 committed by Junio C Hamano
parent c2e8e4b9da
commit 6b33894f99

View File

@ -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);
}