scalar: fix leaking repositories

In the scalar code we iterate through multiple repositories,
initializing each of them. We never clear them though, causing memory
leaks. Plug them.

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-30 11:13:15 +02:00
committed by Junio C Hamano
parent a69d120c07
commit d607bd8816
3 changed files with 3 additions and 0 deletions

View File

@ -732,6 +732,7 @@ static int cmd_reconfigure(int argc, const char **argv)
succeeded = 1;
the_repository = old_repo;
repo_clear(&r);
loop_end:
if (!succeeded) {

View File

@ -2,6 +2,7 @@
test_description='test the `scalar` command'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt,launchctl:true,schtasks:true"

View File

@ -2,6 +2,7 @@
test_description='test the `scalar clone` subcommand'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "${TEST_DIRECTORY}/lib-terminal.sh"