login
Header Space

 
 

[PATCH] --walk-reflogs: do not crash with cyclic reflog ancestry

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>, <junkio@...>
Date: Saturday, January 20, 2007 - 5:28 pm

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>
---
 builtin-log.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

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;
 	}
-- 
1.5.0.rc1.g956c1-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] --walk-reflogs: do not crash with cyclic reflog ance..., Johannes Schindelin, (Sat Jan 20, 5:28 pm)
speck-geostationary