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