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

Re: [PATCH 1/2] unix-socket: fix memory leak when chdir(3p) fails

From
Jeff King <peff@peff.net>
Date
Jan 29, 2025, 20:07 UTC
Message-ID
<20250129200702.GB2331283@coredump.intra.peff.net>
In-Reply-To
<xmqq34h1k02k.fsf@gitster.g>
On Wed, Jan 29, 2025 at 09:21:39AM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> > This leads to a memory leak: when we have already populated the context
> > with the original directory that we need to chdir(3p) back into, but
> > then the chdir(3p) into the socket's parent directory fails, then we
> > won't release the original directory's path. The leak is exposed by
> > t0301, but only via Meson with `meson setup -Dsanitize=leak`:
> 
> Did you mean
> 
>     $ meson configure -Db_sanitize=leak
>     $ meson test t0301-credential-cache
> 
> I'll need to figure out how to make various tweaks at runtime
> working with meson based build tree.  The next thing I need to
> figure out is to see how to get verbose error output from the tests,
> as I cannot just go back to the source tree and say "cd t && sh
> t0301-credential-cache -v -i -x" because the build is out of tree.
I did:
  GIT_BUILD_DIR=$PWD/../build ./t0301-credential-cache.sh -v -i
but I don't know if there's an easier way from meson.

(The "b_" prefix on "sanitize" confused me as well after reading the commit message).

-Peff
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 4 of 13 in “Plug two memory leaks exposed via Meson”
  1. 0/2 Plug two memory leaks exposed via MesonPatrick Steinhardt, Jan 29, 2025
  2. 1/2 unix-socket: fix memory leak when chdir(3p) failsPatrick Steinhardt, Jan 29, 2025
  3. Junio C HamanoJan 29, 2025
  4. Jeff KingJan 29, 2025
  5. Patrick SteinhardtJan 30, 2025
  6. Junio C HamanoJan 30, 2025
  7. 2/2 scalar: free result of `remote_default_branch()`Patrick Steinhardt, Jan 29, 2025
  8. Jeff KingJan 29, 2025
  9. Patrick SteinhardtJan 30, 2025
  10. 0/2 Plug two memory leaks exposed via MesonPatrick Steinhardt, Jan 30, 2025
  11. 1/2 unix-socket: fix memory leak when chdir(3p) failsPatrick Steinhardt, Jan 30, 2025
  12. 2/2 scalar: free result of `remote_default_branch()`Patrick Steinhardt, Jan 30, 2025
  13. Junio C HamanoJan 30, 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.