summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-04-27 03:25:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-27 05:38:50 (GMT)
commitf131db9e3166c528d3b0352b653eb0d9deca5a65 (patch)
tree8b72fbb01f8e7999222e1e74deede4fc8ddf7641 /builtin/am.c
parent3b9e3c2cede15057af3ff8076c45ad5f33829436 (diff)
downloadgit-f131db9e3166c528d3b0352b653eb0d9deca5a65.zip
git-f131db9e3166c528d3b0352b653eb0d9deca5a65.tar.gz
git-f131db9e3166c528d3b0352b653eb0d9deca5a65.tar.bz2
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>
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 826f18b..8dfe8f8 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);
}
/**