Commit 96a289f5f3d2ceeb84ac50216c44107583b48b8d

Sascha Cunz 2012-12-19T05:24:23

clone-empty-test: Don't use one pointer for two things ... so we can clean up correctly.

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));
 }