Skip to content

Commit f131db9

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b9e3c2 commit f131db9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin/am.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
14171417
die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
14181418
state->msg = xstrdup(msg + 2);
14191419
state->msg_len = strlen(state->msg);
1420+
unuse_commit_buffer(commit, buffer);
14201421
}
14211422

14221423
/**

0 commit comments

Comments
 (0)