Skip to content

Commit 7a353ec

Browse files
committed
Merge branch 'rs/simplify-transport-get'
* rs/simplify-transport-get: transport: simplify duplicating a substring in transport_get() using xmemdupz()
2 parents acddf49 + 6b33894 commit 7a353ec

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

transport.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
971971
} else {
972972
/* Unknown protocol in URL. Pass to external handler. */
973973
int len = external_specification_len(url);
974-
char *handler = xmalloc(len + 1);
975-
handler[len] = 0;
976-
strncpy(handler, url, len);
974+
char *handler = xmemdupz(url, len);
977975
transport_helper_init(ret, handler);
978976
}
979977

0 commit comments

Comments
 (0)