transport: fix leaking OID arrays in git:// transport data
The transport data for the "git://" protocol contains two OID arrays that we never free, creating a memory leak. Plug them. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Aug 22, 2024 at 11:17 UTC
ca522341831ad223187fe67b80ad87ad6efe4497
3 files changed
+4
t/t5501-fetch-push-alternates.sh
+1
@@ -4,6 +4,7 @@ test_description='fetch/push involving alternates'
4
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7
+TEST_PASSES_SANITIZE_LEAK=true
8
. ./test-lib.sh
9
10
count_objects () {
t/t5519-push-alternates.sh
+1
@@ -5,6 +5,7 @@ test_description='push to a repository that borrows from elsewhere'
5
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
+TEST_PASSES_SANITIZE_LEAK=true
9
. ./test-lib.sh
10
11
test_expect_success setup '
transport.c
+2
@@ -946,6 +946,8 @@ static int disconnect_git(struct transport *transport)
946
}
947
948
list_objects_filter_release(&data->options.filter_options);
949
+ oid_array_clear(&data->extra_have);
950
+ oid_array_clear(&data->shallow);
951
free(data);
952
return 0;
953
}