diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-08-22 11:18:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-22 18:18:06 +0200 |
commit | 8960819e73d266a114f731a5a9a5dd90e5ab38bc (patch) | |
tree | 24e01b3925a34946045cae85e77dea530dc2ca55 /t/t5703-upload-pack-ref-in-want.sh | |
parent | remote: fix leaks when matching refspecs (diff) | |
download | git-8960819e73d266a114f731a5a9a5dd90e5ab38bc.tar.xz git-8960819e73d266a114f731a5a9a5dd90e5ab38bc.zip |
remote: fix leaking peer ref when expanding refmap
When expanding remote refs via the refspec in `get_expanded_map()`, we
first copy the remote ref and then override its peer ref with the
expanded name. This may cause a memory leak though in case the peer ref
is already set, as this field is being copied by `copy_ref()`, as well.
Fix the leak by freeing the peer ref before we re-assign the field.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5703-upload-pack-ref-in-want.sh')
-rwxr-xr-x | t/t5703-upload-pack-ref-in-want.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh index 191097171b..f75fae52c8 100755 --- a/t/t5703-upload-pack-ref-in-want.sh +++ b/t/t5703-upload-pack-ref-in-want.sh @@ -2,6 +2,7 @@ test_description='upload-pack ref-in-want' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh get_actual_refs () { |