builtin/history: unuse the commit buffer after use
Every call to repo_logmsg_reencode() must be paired with a call to repo_unuse_commit_buffer(), or we may leak an allocated buffer. We have such a leak in "git history", which we can fix by adding an unuse call. The leak-checking tests don't detect this because we only allocate a fresh buffer sometimes: when the message is reencoded, or when we had to load it fresh from the odb (e.g., because the commit was parsed from the commit graph rather than the object contents). But you can see it by running: make SANITIZE=leak cd t GIT_TEST_COMMIT_GRAPH=1 ./t3451-history-reword.sh Helped-by: Jeff King <peff@peff.net> Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>main
parent
3cb9185f65
commit
0e75d17ff7
|
|
@ -161,6 +161,7 @@ out:
|
|||
free_commit_extra_headers(original_extra_headers);
|
||||
strbuf_release(&commit_message);
|
||||
free(original_author);
|
||||
repo_unuse_commit_buffer(repo, commit_with_message, original_message);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue