Skip to content

Commit 6349491

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a9539a9 commit 6349491

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fetch-pack.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,10 @@ void negotiate_using_fetch(const struct oid_array *negotiation_tips,
22272227
trace2_region_leave("fetch-pack", "negotiate_using_fetch", the_repository);
22282228
trace2_data_intmax("negotiate_using_fetch", the_repository,
22292229
"total_rounds", negotiation_round);
2230+
22302231
clear_common_flag(acked_commits);
2232+
object_array_clear(&nt_object_array);
2233+
negotiator.release(&negotiator);
22312234
strbuf_release(&req_buf);
22322235
}
22332236

0 commit comments

Comments
 (0)