Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-03-11 11:58:38 +0300
committerPatrick Steinhardt <ps@pks.im>2016-03-11 13:06:42 +0300
commit35b7bca28bfa1b81bf5cf27898800dc327ca1c61 (patch)
tree6200d0759e6d582d52d777e3da3954a2ea13fbaf /tests/transport
parente756877dbff7b6b706820ce49744808c14941c32 (diff)
tests: transport: fix memory leaks with registering transports
Diffstat (limited to 'tests/transport')
-rw-r--r--tests/transport/register.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/transport/register.c b/tests/transport/register.c
index 67a2efd99..97aae6b20 100644
--- a/tests/transport/register.c
+++ b/tests/transport/register.c
@@ -40,20 +40,23 @@ void test_transport_register__custom_transport_error_remove_non_existing(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;
+ unsigned i;
+ for (i = 0; i < ARRAY_SIZE(urls); i++) {
#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, "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);
+ cl_git_fail_with(git_transport_new(&transport, NULL, urls[i]), -1);
#else
- cl_git_pass(git_transport_new(&transport, NULL, "ssh://somehost:somepath"));
- cl_git_pass(git_transport_new(&transport, NULL, "ssh+git://somehost:somepath"));
- 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);
+ cl_git_pass(git_transport_new(&transport, NULL, urls[i]));
+ transport->free(transport);
#endif
+ }
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"));
+ for (i = 0; i < ARRAY_SIZE(urls); i++) {
#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, "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);
+ cl_git_fail_with(git_transport_new(&transport, NULL, urls[i]), -1);
#else
- cl_git_pass(git_transport_new(&transport, NULL, "ssh://somehost:somepath"));
- cl_git_pass(git_transport_new(&transport, NULL, "ssh+git://somehost:somepath"));
- 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);
+ cl_git_pass(git_transport_new(&transport, NULL, urls[i]));
+ transport->free(transport);
#endif
+ }
}