summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-09-11 15:53:35 +0200
committerPatrick Steinhardt <ps@pks.im>2018-10-26 14:58:51 +0200
commit5fc7d59c79d0e4a86de33c4b9e22713123fb16b7 (patch)
tree85d3271286b55244f4ef5474465116f25c4a18b2
parent54e7cf7ee0bbed03b0ea64f70346d37ee59eae50 (diff)
downloadlibgit2-5fc7d59c79d0e4a86de33c4b9e22713123fb16b7.tar.gz
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. (cherry picked from commit c70713d6e4af563696563e410864eb4a6507757d)
-rw-r--r--src/index.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c
index 2f46cb041..2b47e4dc3 100644
--- a/src/index.c
+++ b/src/index.c
@@ -3510,7 +3510,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;
}