1
0
mirror of https://github.com/git/git synced 2024-07-05 00:58:49 +00:00

--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>
This commit is contained in:
Johannes Schindelin 2007-01-20 22:28:16 +01:00 committed by Junio C Hamano
parent 40ab7c33cd
commit a6c730644b

View File

@ -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;
}