summaryrefslogtreecommitdiff
path: root/src/revwalk.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-05 01:17:59 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-05 02:05:26 +0200
commitf335b42c72fbc4842295f52b0654a8c54716847d (patch)
tree04c074aad8e4f512131c26b71ebddda83a4bf06e /src/revwalk.c
parente06dd9b6d650008c1b0731dea2de5dea1884fd28 (diff)
downloadlibgit2-f335b42c72fbc4842295f52b0654a8c54716847d.tar.gz
Fix segmentation fault when freeing a repository
Disable garbage collection of cross-references to prevent double-freeing. Internal reference management is now done with a separate method. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/revwalk.c')
-rw-r--r--src/revwalk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/revwalk.c b/src/revwalk.c
index 872cdbc43..a1cd0ebb7 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -114,7 +114,7 @@ static git_revwalk_commit *commit_to_walkcommit(git_revwalk *walk, git_commit *c
memset(commit, 0x0, sizeof(git_revwalk_commit));
commit->commit_object = commit_object;
- GIT_OBJECT_INCREF(commit_object);
+ GIT_OBJECT_INCREF(walk->repo, commit_object);
git_hashtable_insert(walk->commits, commit_object, commit);
@@ -230,7 +230,7 @@ int git_revwalk_next(git_commit **commit, git_revwalk *walk)
while ((next = walk->next(&walk->iterator)) != NULL) {
if (!next->uninteresting) {
*commit = next->commit_object;
- GIT_OBJECT_INCREF(*commit);
+ GIT_OBJECT_INCREF(walk->repo, *commit);
return GIT_SUCCESS;
}
}
@@ -248,7 +248,7 @@ void git_revwalk_reset(git_revwalk *walk)
assert(walk);
GIT_HASHTABLE_FOREACH(walk->commits, _unused, commit, {
- git_object_close((git_object *)commit->commit_object);
+ GIT_OBJECT_DECREF(walk->repo, commit->commit_object);
git_revwalk_list_clear(&commit->parents);
free(commit);
});