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>
Patrick Steinhardt committed
Sep 5, 2024 at 12:08 UTC
63494913eced2f0993eb431ad236b03e6ee8cac2
1 file changed
+3
fetch-pack.c
+3
@@ -2227,7 +2227,10 @@ void negotiate_using_fetch(const struct oid_array *negotiation_tips,
2227
trace2_region_leave("fetch-pack", "negotiate_using_fetch", the_repository);
2228
trace2_data_intmax("negotiate_using_fetch", the_repository,
2229
"total_rounds", negotiation_round);
2230
+
2231
clear_common_flag(acked_commits);
2232
+ object_array_clear(&nt_object_array);
2233
+ negotiator.release(&negotiator);
2234
strbuf_release(&req_buf);
2235
}
2236