Re: [PATCH 1/5] revert: free msg in format_todo()
Ramkumar Ramachandra wrote:
> Memory allocated to the fields of msg by get_message() isn't freed.
> This is potentially a big leak,
[because it is in a loop over commits being picked]
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Show 15 quoted lines
> builtin/revert.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/builtin/revert.c b/builtin/revert.c
> index 1ea525c..0c6d3d8 100644
> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -706,6 +706,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;
> }