mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 18:38:58 +00:00
tests: transport: fix memory leaks with registering transports
This commit is contained in:
parent
e756877dbf
commit
35b7bca28b
@ -40,20 +40,23 @@ void test_transport_register__custom_transport_error_remove_non_existing(void)
|
|||||||
|
|
||||||
void test_transport_register__custom_transport_ssh(void)
|
void test_transport_register__custom_transport_ssh(void)
|
||||||
{
|
{
|
||||||
|
const char *urls[] = {
|
||||||
|
"ssh://somehost:somepath",
|
||||||
|
"ssh+git://somehost:somepath",
|
||||||
|
"git+ssh://somehost:somepath",
|
||||||
|
"git@somehost:somepath",
|
||||||
|
};
|
||||||
git_transport *transport;
|
git_transport *transport;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(urls); i++) {
|
||||||
#ifndef GIT_SSH
|
#ifndef GIT_SSH
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "ssh://somehost:somepath"), -1);
|
cl_git_fail_with(git_transport_new(&transport, NULL, urls[i]), -1);
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "ssh+git://somehost:somepath"), -1);
|
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "git+ssh://somehost:somepath"), -1);
|
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "git@somehost:somepath"), -1);
|
|
||||||
#else
|
#else
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "ssh://somehost:somepath"));
|
cl_git_pass(git_transport_new(&transport, NULL, urls[i]));
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "ssh+git://somehost:somepath"));
|
transport->free(transport);
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "git+ssh://somehost:somepath"));
|
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "git@somehost:somepath"));
|
|
||||||
transport->free(transport);
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
cl_git_pass(git_transport_register("ssh", dummy_transport, NULL));
|
cl_git_pass(git_transport_register("ssh", dummy_transport, NULL));
|
||||||
|
|
||||||
@ -63,16 +66,12 @@ void test_transport_register__custom_transport_ssh(void)
|
|||||||
|
|
||||||
cl_git_pass(git_transport_unregister("ssh"));
|
cl_git_pass(git_transport_unregister("ssh"));
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(urls); i++) {
|
||||||
#ifndef GIT_SSH
|
#ifndef GIT_SSH
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "ssh://somehost:somepath"), -1);
|
cl_git_fail_with(git_transport_new(&transport, NULL, urls[i]), -1);
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "ssh+git://somehost:somepath"), -1);
|
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "git+ssh://somehost:somepath"), -1);
|
|
||||||
cl_git_fail_with(git_transport_new(&transport, NULL, "git@somehost:somepath"), -1);
|
|
||||||
#else
|
#else
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "ssh://somehost:somepath"));
|
cl_git_pass(git_transport_new(&transport, NULL, urls[i]));
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "ssh+git://somehost:somepath"));
|
transport->free(transport);
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "git+ssh://somehost:somepath"));
|
|
||||||
cl_git_pass(git_transport_new(&transport, NULL, "git@somehost:somepath"));
|
|
||||||
transport->free(transport);
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user