Thread (17 messages) flat view 17 messages, 4 authors, 11d ago

Re: [PATCH v3] builtin/history: unuse the commit buffer after use

From: Jeff King <hidden>
Date: 2026-09-10 16:03:02

On Thu, Sep 10, 2026 at 08:30:15PM +0530, Kaartic Sivaraam wrote:
Changes since v2:

- Tried to improve the commit message to make it more readable (hopefully).
Thanks, the patch looks good and I think the commit message is accurate.

I probably would have written something much shorter, like:

  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

I'm not suggesting a v3 with this wording, as I think there are
diminishing returns to polishing commit messages forever. Mostly just
food for thought for future patches. :)

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help