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

[PATCH 0/3] fix xstrdup leak in parse_short_opt

From
Lidong Yan via GitGitGadget <gitgitgadget@gmail.com>
Date
May 7, 2025, 02:33 UTC
Message-ID
<pull.1954.git.git.1746585203.gitgitgadget@gmail.com>

Pass a usered defined strdup-like function a parse_opt_ctx to avoid memory leak.

Lidong Yan (3):
  fix xstrdup leak in parse_short_opt
  fix: replace bug where int was incorrectly used as bool
  fix: use strvec_push_wrapper to prevent ubsan failure
 Makefile                             |  1 +
 parse-options.c                      | 23 ++++++++++++++-
 parse-options.h                      | 12 ++++++++
 t/helper/meson.build                 |  1 +
 t/helper/test-free-unknown-options.c | 42 ++++++++++++++++++++++++++++
 t/helper/test-tool.c                 |  1 +
 t/helper/test-tool.h                 |  1 +
 t/t0040-parse-options.sh             | 14 ++++++++++
 8 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 t/helper/test-free-unknown-options.c
base-commit: 6f84262c44a89851c3ae5a6e4c1a9d06b2068d75
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1954%2Fbrandb97%2Ffix-parse-option-leak-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1954/brandb97/fix-parse-option-leak-v1
Pull-Request: https://github.com/git/git/pull/1954
-- 
gitgitgadget
Next: Lidong Yan via GitGitGadget
Message 1 of 14 in “fix xstrdup leak in parse_short_opt”
  1. 0/3 fix xstrdup leak in parse_short_optLidong Yan via GitGitGadget, May 7, 2025
  2. 1/3 fix xstrdup leak in parse_short_optLidong Yan via GitGitGadget, May 7, 2025
  3. Patrick SteinhardtMay 7, 2025
  4. 2/3 fix: replace bug where int was incorrectly used as boolLidong Yan via GitGitGadget, May 7, 2025
  5. Patrick SteinhardtMay 7, 2025
  6. 3/3 fix: use strvec_push_wrapper to prevent ubsan failureLidong Yan via GitGitGadget, May 7, 2025
  7. Patrick SteinhardtMay 7, 2025
  8. lidongyanMay 7, 2025
  9. parse-options: fix xstrdup leak in parse_options_step parse-options:984Lidong Yan via GitGitGadget, May 7, 2025
  10. Patrick SteinhardtMay 9, 2025
  11. lidongyanMay 9, 2025
  12. Phillip WoodMay 9, 2025
  13. lidongyanMay 9, 2025
  14. parse-options: fix memory leak when calling `parse_options`Lidong Yan via GitGitGadget, May 9, 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.