diffcore-break: fix leaking filespecs when merging broken pairs

When merging file pairs after they have been broken up we queue a new
file pair and discard the broken-up ones. The newly-queued file pair
reuses one filespec of the broken up pairs each, where the respective
other filespec gets discarded. But we only end up freeing the filespec's
data, not the filespec itself, and thus leak memory.

Fix these leaks by using `free_filespec()` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-09-26 13:47:08 +02:00
committed by Junio C Hamano
parent fa016423c7
commit 12dfc2475c
6 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,8 @@
#!/bin/sh
test_description='git commit summary'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '