{"thread":{"id":"6457","subject":"[PATCH] --walk-reflogs: do not crash with cyclic reflog ancestry","startedAt":"2007-01-20T21:28:16Z","lastAt":"2007-01-20T21:28:16Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"32174","messageId":"Pine.LNX.4.63.0701202227500.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6457","inReplyTo":null,"subject":"[PATCH] --walk-reflogs: do not crash with cyclic reflog ancestry","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-20T21:28:16Z","receivedAt":"2007-01-20T21:28:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSince you can reset --hard to any revision you already had, when\ntraversing the reflog ancestry, we may not free() the commit buffer.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n builtin-log.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex f3cff13..13a3f9b 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -50,8 +50,11 @@ static int cmd_log_walk(struct rev_info *rev)\n \tprepare_revision_walk(rev);\n \twhile ((commit = get_revision(rev)) != NULL) {\n \t\tlog_tree_commit(rev, commit);\n-\t\tfree(commit->buffer);\n-\t\tcommit->buffer = NULL;\n+\t\tif (!rev->reflog_info) {\n+\t\t\t/* we allow cycles in reflog ancestry */\n+\t\t\tfree(commit->buffer);\n+\t\t\tcommit->buffer = NULL;\n+\t\t}\n \t\tfree_commit_list(commit->parents);\n \t\tcommit->parents = NULL;\n \t}\n-- \n1.5.0.rc1.g956c1-dirty\n"}]}