diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-01-20 22:28:16 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-20 22:58:42 -0800 |
commit | a6c730644b7e1d35bd0d26962dbc978aa47d1863 (patch) | |
tree | 1662a895991e20bfe0f0036c10137e93b05b872d /builtin-log.c | |
parent | 40ab7c33cd6dfdf887ed15baee1325ee445eced7 (diff) | |
download | git-a6c730644b7e1d35bd0d26962dbc978aa47d1863.tar.gz |
--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>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin-log.c b/builtin-log.c index f3cff13edc..13a3f9b25d 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; } |