From: Jeff King Date: Thu, 27 Apr 2017 03:25:55 +0000 (-0400) Subject: am: fix commit buffer leak in get_commit_info() X-Git-Tag: v2.13.1~33^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f131db9e3166c528d3b0352b653eb0d9deca5a65;p=thirdparty%2Fgit.git am: fix commit buffer leak in get_commit_info() Calling logmsg_reencode() may allocate a buffer for the commit message (because we need to load it from disk, or because it needs re-encoded). We must "unuse" it afterwards to free it. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/builtin/am.c b/builtin/am.c index 826f18ba12..8dfe8f84fa 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1417,6 +1417,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit) die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid)); state->msg = xstrdup(msg + 2); state->msg_len = strlen(state->msg); + unuse_commit_buffer(commit, buffer); } /**