diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-08-01 12:38:20 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-01 08:47:35 -0700 |
| commit | 8e2e28799d2353e32c393bd7938c457e5e08fc63 (patch) | |
| tree | 1aa91ad6229973707d392e5a0fec522e66cfd026 /commit-reach.c | |
| parent | builtin/log: fix leaking branch name when creating cover letters (diff) | |
| download | git-8e2e28799d2353e32c393bd7938c457e5e08fc63.tar.gz git-8e2e28799d2353e32c393bd7938c457e5e08fc63.zip | |
builtin/describe: fix memory leak with `--contains=`
When calling `git describe --contains=`, we end up invoking
`cmd_name_rev()` with some munged argv array. This array may contain
allocated strings and furthermore will likely be modified by the called
function. This results in two memory leaks:
- First, we leak the array that we use to assemble the arguments.
- Second, we leak the allocated strings that we may have put into the
array.
Fix those leaks by creating a separate copy of the array that we can
hand over to `cmd_name_rev()`. This allows us to free all strings
contained in the `strvec`, as the original vector will not be modified
anymore.
Furthermore, free both the `strvec` and the copied array to fix the
first memory leak.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-reach.c')
0 files changed, 0 insertions, 0 deletions
