summaryrefslogtreecommitdiff
path: root/builtin/revert.c
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2011-12-14 22:24:28 +0530
committerJunio C Hamano <gitster@pobox.com>2011-12-15 13:00:22 -0800
commitbf3de2b373d4fa55b6040c7dc6f7f8668ef45c19 (patch)
tree111d251a3060c8ca8ec15b4f583cb06795f990cc /builtin/revert.c
parentd596118d7a9b104db10e64b2680a30ea80f1439c (diff)
downloadgit-bf3de2b373d4fa55b6040c7dc6f7f8668ef45c19.tar.gz
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>
Diffstat (limited to 'builtin/revert.c')
-rw-r--r--builtin/revert.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/revert.c b/builtin/revert.c
index 028bcbcd75..76a1633b9b 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;
}