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 <jrnieder@gmail.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramkumar Ramachandra committed Dec 14, 2011 at 22:24 UTC bf3de2b373d4fa55b6040c7dc6f7f8668ef45c19
1 file changed +1
builtin/revert.c
+1
@@ -709,6 +709,7 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list,
709 if (get_message(cur->item, &msg))
710 return error(_("Cannot get commit message for %s"), sha1_abbrev);
711 strbuf_addf(buf, "%s %s %s\n", action_str, sha1_abbrev, msg.subject);
712 + free_message(&msg);
713 }
714 return 0;
715 }