builtin/blame: fix leaking blame entries with --incremental

When passing `--incremental` to git-blame(1) we exit early by jumping to
the `cleanup` label. But some of the cleanups we perform are handled
between the `goto` and its label, and thus we leak the data.

Move the cleanups after the `cleanup` label. While at it, move the logic
to free the scoreboard's `final_buf` into `cleanup_scoreboard()` and
drop its `const` declaration.

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-11-20 14:39:30 +01:00
committed by Junio C Hamano
parent 2664f2a0cb
commit 65a1b7e2bd
4 changed files with 10 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
#!/bin/sh
test_description='git blame encoding conversion'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if ! test_have_prereq ICONV