Commit b3d94069b4c03374bee482df4ea20eed022743dc

Vicent Marti 2011-05-17T14:51:42

repository: Properly free the index on close

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/repository.c b/src/repository.c
index 1072b22..eab56fc 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -315,8 +315,10 @@ void git_repository_free(git_repository *repo)
 	if (repo->db != NULL)
 		git_odb_close(repo->db);
 
-	if (repo->index != NULL)
+	if (repo->index != NULL) {
+		repo->index->repository = NULL;
 		git_index_free(repo->index);
+	}
 
 	free(repo);
 }