]> git.ipfire.org Git - thirdparty/git.git/commitdiff
transport: fix leaking OID arrays in git:// transport data
authorPatrick Steinhardt <ps@pks.im>
Thu, 22 Aug 2024 09:17:41 +0000 (11:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2024 16:18:05 +0000 (09:18 -0700)
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>
t/t5501-fetch-push-alternates.sh
t/t5519-push-alternates.sh
transport.c

index 66f19a4ef2b6ed2ac6dc2e133e1df7010cdcd98d..0c8668a1b8e3e39d6b263b2b87888b3503eeb5c2 100755 (executable)
@@ -4,6 +4,7 @@ test_description='fetch/push involving alternates'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 count_objects () {
index 20ba604dfde1629b5ab75226f41ef2e4b3814d07..72e97b15fabbb821eaf5d88a24fee0ae4c8de6f8 100755 (executable)
@@ -5,6 +5,7 @@ test_description='push to a repository that borrows from elsewhere'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index 7c4af9f56f2c10366acd398ed81df7090d35266f..f0672fdc5058b61ab6c7440a85ed5446afd4b25a 100644 (file)
@@ -946,6 +946,8 @@ static int disconnect_git(struct transport *transport)
        }
 
        list_objects_filter_release(&data->options.filter_options);
+       oid_array_clear(&data->extra_have);
+       oid_array_clear(&data->shallow);
        free(data);
        return 0;
 }