summaryrefslogtreecommitdiffstats
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-05 12:08:40 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-05 17:49:10 +0200
commit63494913eced2f0993eb431ad236b03e6ee8cac2 (patch)
tree04e3bc70bddc380863411f45ed84cf64af4715b4 /fetch-pack.c
parentt/test-lib: allow skipping leak checks for passing tests (diff)
downloadgit-63494913eced2f0993eb431ad236b03e6ee8cac2.tar.xz
git-63494913eced2f0993eb431ad236b03e6ee8cac2.zip
fetch-pack: fix memory leaks on fetch negotiation
We leak both the `nt_object_array` and `negotiator` structures in `negotiate_using_fetch()`. Plug both of these leaks. These leaks were exposed by t5516, but fixing them is not sufficient to make the whole test suite leak free. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 58b4581ad8..0ed82feda1 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -2227,7 +2227,10 @@ void negotiate_using_fetch(const struct oid_array *negotiation_tips,
trace2_region_leave("fetch-pack", "negotiate_using_fetch", the_repository);
trace2_data_intmax("negotiate_using_fetch", the_repository,
"total_rounds", negotiation_round);
+
clear_common_flag(acked_commits);
+ object_array_clear(&nt_object_array);
+ negotiator.release(&negotiator);
strbuf_release(&req_buf);
}