Merge branch 'jc/transport-leakfix'
Leakfix. * jc/transport-leakfix: transport: fix leak with transport helper URLs
This commit is contained in:
@ -1115,6 +1115,7 @@ static struct transport_vtable builtin_smart_vtable = {
|
|||||||
struct transport *transport_get(struct remote *remote, const char *url)
|
struct transport *transport_get(struct remote *remote, const char *url)
|
||||||
{
|
{
|
||||||
const char *helper;
|
const char *helper;
|
||||||
|
char *helper_to_free = NULL;
|
||||||
const char *p;
|
const char *p;
|
||||||
struct transport *ret = xcalloc(1, sizeof(*ret));
|
struct transport *ret = xcalloc(1, sizeof(*ret));
|
||||||
|
|
||||||
@ -1139,10 +1140,11 @@ struct transport *transport_get(struct remote *remote, const char *url)
|
|||||||
while (is_urlschemechar(p == url, *p))
|
while (is_urlschemechar(p == url, *p))
|
||||||
p++;
|
p++;
|
||||||
if (starts_with(p, "::"))
|
if (starts_with(p, "::"))
|
||||||
helper = xstrndup(url, p - url);
|
helper = helper_to_free = xstrndup(url, p - url);
|
||||||
|
|
||||||
if (helper) {
|
if (helper) {
|
||||||
transport_helper_init(ret, helper);
|
transport_helper_init(ret, helper);
|
||||||
|
free(helper_to_free);
|
||||||
} else if (starts_with(url, "rsync:")) {
|
} else if (starts_with(url, "rsync:")) {
|
||||||
die(_("git-over-rsync is no longer supported"));
|
die(_("git-over-rsync is no longer supported"));
|
||||||
} else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) {
|
} else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) {
|
||||||
|
Reference in New Issue
Block a user