Skip to content

Commit bf3de2b

Browse files
artagnongitster
authored andcommitted
revert: free msg in format_todo()
Memory allocated to the fields of msg by get_message() isn't freed. This is potentially a big leak, because fresh memory is allocated to store the commit message for each commit. Fix this using free_message(). Reported-by: Jonathan Nieder <[email protected]> Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d596118 commit bf3de2b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin/revert.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list,
709709
if (get_message(cur->item, &msg))
710710
return error(_("Cannot get commit message for %s"), sha1_abbrev);
711711
strbuf_addf(buf, "%s %s %s\n", action_str, sha1_abbrev, msg.subject);
712+
free_message(&msg);
712713
}
713714
return 0;
714715
}

0 commit comments

Comments
 (0)