]> Kevux Git Server - rit/commit
merge: fix leaking merge bases
authorPatrick Steinhardt <ps@pks.im>
Tue, 11 Jun 2024 09:21:11 +0000 (11:21 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Jun 2024 20:15:08 +0000 (13:15 -0700)
commit44ec7c575f914d77787a17cefd094e3c46b8b12b
tree185a726b608127146430586f18dcdbb77f981372
parent77241a6b5e3aadbc697632600e7e187ae94c4ca6
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>
17 files changed:
builtin/merge-tree.c
builtin/merge.c
commit.c
commit.h
log-tree.c
merge-ort-wrappers.c
merge-ort-wrappers.h
merge-ort.c
merge-ort.h
merge-recursive.c
merge-recursive.h
sequencer.c
t/t3430-rebase-merges.sh
t/t6402-merge-rename.sh
t/t6430-merge-recursive.sh
t/t6436-merge-overwrite.sh
t/t7611-merge-abort.sh