merge-file: fix memory leaks on error path
commite72e12cc02d80e4ebf01e0a3d170617211ae7c70
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 1 Jul 2022 10:42:56 +0000 (1 12:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Jul 2022 18:43:43 +0000 (1 11:43 -0700)
treefd3159ad8ebe26def9f0a2d564b239024089a1f4
parent480a0e30a78a6a86e1ea97059f72e4bf4299d052
merge-file: fix memory leaks on error path

Fix a memory leak in "merge-file", we need to loop over the "mmfs"
array and free() what we've got so far when we error out. As a result
we can mark a test as passing with SANITIZE=leak using
"TEST_PASSES_SANITIZE_LEAK=true".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge-file.c
t/t6403-merge-file.sh