Commit c70713d6e4af563696563e410864eb4a6507757d

Etienne Samson 2018-09-11T15:53:35

index: release the snapshot instead of freeing the index Previously we would assert in index_free because the reader incrementation would not be balanced. Release the snapshot normally, so the variable gets decremented before the index is freed.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/index.c b/src/index.c
index 0450d9f..465efaa 100644
--- a/src/index.c
+++ b/src/index.c
@@ -3550,7 +3550,7 @@ int git_index_snapshot_new(git_vector *snap, git_index *index)
 	error = git_vector_dup(snap, &index->entries, index->entries._cmp);
 
 	if (error < 0)
-		git_index_free(index);
+		git_index_snapshot_release(snap, index);
 
 	return error;
 }