Skip to content

Commit

Permalink
revert: free msg in format_todo()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ramkumar Ramachandra authored and Junio C Hamano committed Dec 15, 2011
1 parent d596118 commit bf3de2b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions builtin/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bf3de2b

Please sign in to comment.