Commit 971c90befe4dfac4c235fa59d65f7e652fc27e1d

Vicent Marti 2011-02-28T16:54:13

Do not free the index if it's owned by a repository Signed-off-by: Vicent Marti <tanoku@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/index.c b/src/index.c
index 46bbafd..95e56b7 100644
--- a/src/index.c
+++ b/src/index.c
@@ -166,7 +166,7 @@ int git_index_open_inrepo(git_index **index_out, git_repository *repo)
 
 void git_index_free(git_index *index)
 {
-	if (index == NULL)
+	if (index == NULL || index->repository != NULL)
 		return;
 
 	git_index_clear(index);