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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 26, 2017 at 23:25 UTC
f131db9e3166c528d3b0352b653eb0d9deca5a65
1 file changed
+1
builtin/am.c
+1
@@ -1417,6 +1417,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
1417
die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
1418
state->msg = xstrdup(msg + 2);
1419
state->msg_len = strlen(state->msg);
1420
+ unuse_commit_buffer(commit, buffer);
1421
}
1422
1423
/**