diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-08-01 12:40:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-01 08:47:36 -0700 |
commit | 2d197e4a0f34b97b03416666bebcb993e41fed26 (patch) | |
tree | d02e8d86af266c6c7e7fc33b7495379126f67a38 /t/helper/test-path-utils.c | |
parent | 2e875b6cb408351c07919efb024ee1b52e0a3ac3 (diff) |
builtin/rev-parse: fix memory leak with `--parseopt`
The `--parseopt` mode allows shell scripts to have the same option
parsing mode as we have in C builtins. It soaks up a set of option
descriptions via stdin and massages them into proper `struct option`s
that we can then use to parse a set of arguments.
We only partially free those options when done though, creating a memory
leak. Interestingly, we only end up free'ing the first option's help,
which is of course wrong.
Fix this by freeing all option's help fields as well as their `argh`
fields to plug this memory leak.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-path-utils.c')
0 files changed, 0 insertions, 0 deletions