upload-pack: fix leaking URI protocols

We don't clear `struct upload_pack::uri_protocols`, which causes a
memory leak. Fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-11-05 07:17:06 +01:00 committed by Junio C Hamano
parent 0b20a28811
commit 3b373150c8
2 changed files with 2 additions and 0 deletions

View File

@ -7,6 +7,7 @@ TEST_NO_CREATE_REPO=1
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh
# Test protocol v2 with 'git://' transport # Test protocol v2 with 'git://' transport

View File

@ -166,6 +166,7 @@ static void upload_pack_data_clear(struct upload_pack_data *data)
object_array_clear(&data->extra_edge_obj); object_array_clear(&data->extra_edge_obj);
list_objects_filter_release(&data->filter_options); list_objects_filter_release(&data->filter_options);
string_list_clear(&data->allowed_filters, 0); string_list_clear(&data->allowed_filters, 0);
string_list_clear(&data->uri_protocols, 0);
free((char *)data->pack_objects_hook); free((char *)data->pack_objects_hook);
} }