git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode()

From
Jeff King <peff@peff.net>
Date
Jun 5, 2025, 07:53 UTC
Message-ID
<20250605075301.GD2066712@coredump.intra.peff.net>
In-Reply-To
<pull.1988.v2.git.git.1749104846531.gitgitgadget@gmail.com>
On Thu, Jun 05, 2025 at 06:27:26AM +0000, Lidong Yan via GitGitGadget wrote:
Show 6 quoted lines
> From: Lidong Yan <502024330056@smail.nju.edu.cn>
> 
> pretty.c:repo_logmsg_reencode() allocated memory should be freed with
> repo_unuse_commit_buffer(). Callers sometimes forgot free it at exit
> point. Add `repo_unuse_commit_buffer()` in insert_records_from_trailers
> at builtin/shortlog.c and create_commit at builtin/replay.c

The patch here looks fine, and I can confirm with the hacky test-patch I showed elsewhere in the thread that the case in replay.c is fixed.

I don't think the shortlog one is triggered by the test suite, and it's probably not worth adding a specific test for a commit with no header separator.

-Peff
Previous: Lidong Yan via GitGitGadget
Message 7 of 7 in “repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode()”
  1. repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode()Lidong Yan via GitGitGadget, Jun 4, 2025
  2. Patrick SteinhardtJun 4, 2025
  3. lidongyanJun 4, 2025
  4. Jeff KingJun 5, 2025
  5. lidongyanJun 6, 2025
  6. repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode()Lidong Yan via GitGitGadget, Jun 5, 2025
  7. Jeff KingJun 5, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.