merge: fix leaking merge bases
When calling either the recursive or the ORT merge machineries we need to provide a list of merge bases. The ownership of that parameter is then implicitly transferred to the callee, which is somewhat fishy. Furthermore, that list may leak in some cases where the merge machinery runs into an error, thus causing a memory leak. Refactor the code such that we stop transferring ownership. Instead, the merge machinery will now create its own local copies of the passed in list as required if they need to modify the list. Free the list at the callsites as required. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
77241a6b5e
commit
44ec7c575f
@ -1047,6 +1047,7 @@ static int do_remerge_diff(struct rev_info *opt,
|
||||
log_tree_diff_flush(opt);
|
||||
|
||||
/* Cleanup */
|
||||
free_commit_list(bases);
|
||||
cleanup_additional_headers(&opt->diffopt);
|
||||
strbuf_release(&parent1_desc);
|
||||
strbuf_release(&parent2_desc);
|
||||
|
Reference in New Issue
Block a user