aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-30 11:13:15 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-30 11:23:02 -0700
commitd607bd88161d1826adc236bf7cf758e754becd61 (patch)
tree50d512369413a1b9db37274624f4371217e12f7c
parenta69d120c077ce4e3f6164e23d41147370a0d687a (diff)
downloadgit-d607bd88161d1826adc236bf7cf758e754becd61.tar.gz
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>
-rw-r--r--scalar.c1
-rwxr-xr-xt/t9210-scalar.sh1
-rwxr-xr-xt/t9211-scalar-clone.sh1
3 files changed, 3 insertions, 0 deletions
diff --git a/scalar.c b/scalar.c
index 09560aeab5..ede616ad4f 100644
--- a/scalar.c
+++ b/scalar.c
@@ -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) {
diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh
index e8613990e1..a131a6c029 100755
--- a/t/t9210-scalar.sh
+++ b/t/t9210-scalar.sh
@@ -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"
diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh
index 7869f45ee6..c16ea67c1d 100755
--- a/t/t9211-scalar-clone.sh
+++ b/t/t9211-scalar-clone.sh
@@ -2,6 +2,7 @@
test_description='test the `scalar clone` subcommand'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "${TEST_DIRECTORY}/lib-terminal.sh"