transport: fix leaking negotiation tips

We do not free negotiation tips in the transport's smart options. Fix this by freeing them on disconnect. 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:18 UTC 13b23d2da552b9476a0025562bc4ab8954d5be45
2 files changed +5
t/t5510-fetch.sh
+1
@@ -5,6 +5,7 @@ test_description='Per branch config variables affects "git fetch".
5
6 '
7
8 +TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10 . "$TEST_DIRECTORY"/lib-bundle.sh
11
transport.c
+4
@@ -947,6 +947,10 @@ static int disconnect_git(struct transport *transport)
947 finish_connect(data->conn);
948 }
949
950 + if (data->options.negotiation_tips) {
951 + oid_array_clear(data->options.negotiation_tips);
952 + free(data->options.negotiation_tips);
953 + }
954 list_objects_filter_release(&data->options.filter_options);
955 oid_array_clear(&data->extra_have);
956 oid_array_clear(&data->shallow);