diff options
author | Edward Thomson <ethomson@github.com> | 2016-03-17 06:55:24 -0700 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-03-17 06:55:24 -0700 |
commit | a151eb544b751ea2103b202d036df59838c93735 (patch) | |
tree | 00b451c591ee30c2324c227d7a16cba35fc00584 | |
parent | 31dc0599c51f45dc31e3f7bac75387668361d2ff (diff) | |
parent | 35b7bca28bfa1b81bf5cf27898800dc327ca1c61 (diff) | |
download | libgit2-a151eb544b751ea2103b202d036df59838c93735.tar.gz |
Merge pull request #3685 from pks-t/pks/memleaks
Test memleaks
-rw-r--r-- | tests/index/nsec.c | 4 | ||||
-rw-r--r-- | tests/transport/register.c | 35 |
2 files changed, 19 insertions, 20 deletions
diff --git a/tests/index/nsec.c b/tests/index/nsec.c index 326b19540..ea8a26743 100644 --- a/tests/index/nsec.c +++ b/tests/index/nsec.c @@ -56,7 +56,7 @@ static bool should_expect_nsecs(void) p_unlink(nsec_path.ptr); - git_buf_clear(&nsec_path); + git_buf_free(&nsec_path); return expect; } @@ -89,7 +89,7 @@ void test_index_nsec__staging_maintains_other_nanos(void) const git_index_entry *entry; bool expect_nsec, test_file_has_nsec; - expect_nsec = should_expect_nsecs(); + expect_nsec = should_expect_nsecs(); test_file_has_nsec = try_create_file_with_nsec_timestamp("nsecs/a.txt"); cl_assert_equal_b(expect_nsec, test_file_has_nsec); 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 + } } |