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>
Patrick Steinhardt committed
Sep 30, 2024 at 11:13 UTC
d607bd88161d1826adc236bf7cf758e754becd61
3 files changed
+3
scalar.c
+1
@@ -732,6 +732,7 @@ static int cmd_reconfigure(int argc, const char **argv)
732
succeeded = 1;
733
734
the_repository = old_repo;
735
+ repo_clear(&r);
736
737
loop_end:
738
if (!succeeded) {
t/t9210-scalar.sh
+1
@@ -2,6 +2,7 @@
2
3
test_description='test the `scalar` command'
4
5
+TEST_PASSES_SANITIZE_LEAK=true
6
. ./test-lib.sh
7
8
GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt,launchctl:true,schtasks:true"
t/t9211-scalar-clone.sh
+1
@@ -2,6 +2,7 @@
2
3
test_description='test the `scalar clone` subcommand'
4
5
+TEST_PASSES_SANITIZE_LEAK=true
6
. ./test-lib.sh
7
. "${TEST_DIRECTORY}/lib-terminal.sh"
8