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

[PATCH 0/4] Fix resource leaks in various helpers and builtin commands

From
Hoyoung Lee <lhywkd22@gmail.com>
Date
Jul 22, 2025, 07:36 UTC
Message-ID
<20250722073634.1080217-1-lhywkd22@gmail.com>

This patch series fixes several cases where file descriptors were not properly closed on error paths. The changes affect helper programs and a builtin command, and ensure that system resources are correctly released before returning from the function.

Each fix is minimal and follows the existing style of the surrounding code. These changes help improve the robustness of the code by avoiding potential file descriptor leaks.

Hoyoung Lee (4):
  t/helper/test-truncate: close file descriptor after truncation
  builtin/archive: close file descriptor on dup2() failure
  t/helper/test-delta: close fd if fstat() fails after open()
  t/helper/test-delta: close fd if fstat() fails after second open()
 builtin/archive.c        | 1 +
 t/helper/test-delta.c    | 3 +++
 t/helper/test-truncate.c | 3 +++
 3 files changed, 7 insertions(+)
-- 
2.34.1
Next: Hoyoung Lee
Message 1 of 5 in “Fix resource leaks in various helpers and builtin commands”
  1. 0/4 Fix resource leaks in various helpers and builtin commandsHoyoung Lee, Jul 22, 2025
  2. 1/4 t/helper/test-truncate: close file descriptor after truncationHoyoung Lee, Jul 22, 2025
  3. 2/4 builtin/archive: close file descriptor on dup2() failureHoyoung Lee, Jul 22, 2025
  4. 3/4 t/helper/test-delta: close fd if fstat() fails after open()Hoyoung Lee, Jul 22, 2025
  5. 4/4 t/helper/test-delta: close fd if fstat() fails after second open()Hoyoung Lee, Jul 22, 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.