diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-09-26 13:46:06 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-27 08:25:34 -0700 |
| commit | 3aef7a05adb2868118181eb5605fffa65a9af2c8 (patch) | |
| tree | 25fd341033495e60ba383ad7f327864a60056ccd /t | |
| parent | builtin/help: fix leaking `html_path` when reading config multiple times (diff) | |
| download | git-3aef7a05adb2868118181eb5605fffa65a9af2c8.tar.gz git-3aef7a05adb2868118181eb5605fffa65a9af2c8.zip | |
git: fix leaking argv when handling builtins
In `handle_builtin()` we may end up creating an ad-hoc argv array in
case we see that the command line contains the "--help" parameter. In
this case we observe two memory leaks though:
- We leak the `struct strvec` itself because we directly exit after
calling `run_builtin()`, without bothering about any cleanups.
- Even if we free'd that vector we'd end up leaking some of its
strings because `run_builtin()` will modify the array.
Plug both of these leaks.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rwxr-xr-x | t/t0012-help.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t0012-help.sh b/t/t0012-help.sh index 1d273d91c2..9eae0d8356 100755 --- a/t/t0012-help.sh +++ b/t/t0012-help.sh @@ -2,6 +2,7 @@ test_description='help' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh configure_help () { |
