clone-empty-test: Don't use one pointer for two things ... so we can clean up correctly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/tests-clar/clone/empty.c b/tests-clar/clone/empty.c
index 0f0edcb..8f2e6ff 100644
--- a/tests-clar/clone/empty.c
+++ b/tests-clar/clone/empty.c
@@ -6,6 +6,7 @@
static git_clone_options g_options;
static git_remote *g_origin;
static git_repository *g_repo;
+static git_repository *g_repo_cloned;
void test_clone_empty__initialize(void)
{
@@ -29,6 +30,9 @@ void test_clone_empty__cleanup(void)
static void cleanup_repository(void *path)
{
cl_fixture_cleanup((const char *)path);
+
+ git_repository_free(g_repo_cloned);
+ g_repo_cloned = NULL;
}
void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
@@ -40,7 +44,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
cl_git_pass(git_remote_new(&g_origin, NULL, "origin", "./empty_bare.git", GIT_REMOTE_DEFAULT_FETCH));
g_options.bare = true;
- cl_git_pass(git_clone(&g_repo, g_origin, "./empty", &g_options));
+ cl_git_pass(git_clone(&g_repo_cloned, g_origin, "./empty", &g_options));
}
void test_clone_empty__can_clone_an_empty_local_repo(void)
@@ -51,7 +55,7 @@ void test_clone_empty__can_clone_an_empty_local_repo(void)
g_origin = NULL;
cl_git_pass(git_remote_new(&g_origin, NULL, "origin", "./empty_bare.git", GIT_REMOTE_DEFAULT_FETCH));
- cl_git_pass(git_clone(&g_repo, g_origin, "./empty", &g_options));
+ cl_git_pass(git_clone(&g_repo_cloned, g_origin, "./empty", &g_options));
}
void test_clone_empty__can_clone_an_empty_standard_repo(void)
@@ -66,5 +70,5 @@ void test_clone_empty__can_clone_an_empty_standard_repo(void)
cl_set_cleanup(&cleanup_repository, "./empty");
- cl_git_pass(git_clone(&g_repo, g_origin, "./empty", &g_options));
+ cl_git_pass(git_clone(&g_repo_cloned, g_origin, "./empty", &g_options));
}