Skip to content

Commit d1f33c7

Browse files
rscharfegitster
authored andcommitted
history: initialize rev_info in cmd_history_reword()
git history reword expects a single valid revision argument and errors out if it doesn't get it. In that case the struct rev_info passed to release_revisions() for cleanup is still uninitialized, which can result in attempts to free(3) random pointers. Avoid that by initializing the structure. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1278a26 commit d1f33c7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

builtin/history.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static int cmd_history_reword(int argc,
425425
};
426426
struct strbuf reflog_msg = STRBUF_INIT;
427427
struct commit *original, *rewritten;
428-
struct rev_info revs;
428+
struct rev_info revs = { 0 };
429429
int ret;
430430

431431
argc = parse_options(argc, argv, prefix, options, usage, 0);

0 commit comments

Comments
 (0)