summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-01-20 21:28:16 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-21 06:58:42 (GMT)
commita6c730644b7e1d35bd0d26962dbc978aa47d1863 (patch)
tree1662a895991e20bfe0f0036c10137e93b05b872d
parent40ab7c33cd6dfdf887ed15baee1325ee445eced7 (diff)
downloadgit-a6c730644b7e1d35bd0d26962dbc978aa47d1863.zip
git-a6c730644b7e1d35bd0d26962dbc978aa47d1863.tar.gz
git-a6c730644b7e1d35bd0d26962dbc978aa47d1863.tar.bz2
--walk-reflogs: do not crash with cyclic reflog ancestry
Since you can reset --hard to any revision you already had, when traversing the reflog ancestry, we may not free() the commit buffer. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--builtin-log.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin-log.c b/builtin-log.c
index f3cff13..13a3f9b 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -50,8 +50,11 @@ static int cmd_log_walk(struct rev_info *rev)
prepare_revision_walk(rev);
while ((commit = get_revision(rev)) != NULL) {
log_tree_commit(rev, commit);
- free(commit->buffer);
- commit->buffer = NULL;
+ if (!rev->reflog_info) {
+ /* we allow cycles in reflog ancestry */
+ free(commit->buffer);
+ commit->buffer = NULL;
+ }
free_commit_list(commit->parents);
commit->parents = NULL;
}