From: Ramkumar Ramachandra Date: Wed, 14 Dec 2011 16:54:28 +0000 (+0530) Subject: revert: free msg in format_todo() X-Git-Tag: v1.7.9-rc0~15^2~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bf3de2b373d4fa55b6040c7dc6f7f8668ef45c19;p=git.git 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 Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- diff --git a/builtin/revert.c b/builtin/revert.c index 028bcbcd7..76a1633b9 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -709,6 +709,7 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list, if (get_message(cur->item, &msg)) return error(_("Cannot get commit message for %s"), sha1_abbrev); strbuf_addf(buf, "%s %s %s\n", action_str, sha1_abbrev, msg.subject); + free_message(&msg); } return 0; }