From a6c730644b7e1d35bd0d26962dbc978aa47d1863 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 20 Jan 2007 22:28:16 +0100 Subject: --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 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; } -- cgit v0.10.2-6-g49f6