From: Johannes Schindelin Date: Sat, 20 Jan 2007 21:28:16 +0000 (+0100) Subject: --walk-reflogs: do not crash with cyclic reflog ancestry X-Git-Tag: v1.5.0-rc2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a6c730644b7e1d35bd0d26962dbc978aa47d1863;p=git.git --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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-log.c b/builtin-log.c index f3cff13ed..13a3f9b25 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; }