aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-07-01 12:37:32 +0200
committerJunio C Hamano <gitster@pobox.com>2022-07-01 13:38:49 -0700
commit330ca8501b6b4cb7afec20dc0b9513542118e9de (patch)
treeccb23255977c428a8a7f81330c13d7702a23804a
parentGit 2.37 (diff)
downloadgit-330ca8501b6b4cb7afec20dc0b9513542118e9de.tar.gz
git-330ca8501b6b4cb7afec20dc0b9513542118e9de.zip
test-tool test-hash: fix a memory leak
Fix a memory leak in "test-tool test-hash" which has been there since b57cbbf8a86 (test-sha1: test hashing large buffer, 2006-06-24), as a result we can mark more tests as passing with SANITIZE=leak using "TEST_PASSES_SANITIZE_LEAK=true". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--t/helper/test-hash.c1
-rwxr-xr-xt/t0015-hash.sh3
-rwxr-xr-xt/t5308-pack-detect-duplicates.sh2
-rwxr-xr-xt/t5309-pack-delta-cycles.sh2
-rwxr-xr-xt/t5321-pack-large-objects.sh2
5 files changed, 9 insertions, 1 deletions
diff --git a/t/helper/test-hash.c b/t/helper/test-hash.c
index 261c545b9d..5860dab0ff 100644
--- a/t/helper/test-hash.c
+++ b/t/helper/test-hash.c
@@ -54,5 +54,6 @@ int cmd_hash_impl(int ac, const char **av, int algo)
fwrite(hash, 1, algop->rawsz, stdout);
else
puts(hash_to_hex_algop(hash, algop));
+ free(buffer);
return 0;
}
diff --git a/t/t0015-hash.sh b/t/t0015-hash.sh
index 086822fc45..0a087a1983 100755
--- a/t/t0015-hash.sh
+++ b/t/t0015-hash.sh
@@ -1,8 +1,9 @@
#!/bin/sh
test_description='test basic hash implementation'
-. ./test-lib.sh
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
test_expect_success 'test basic SHA-1 hash values' '
test-tool sha1 </dev/null >actual &&
diff --git a/t/t5308-pack-detect-duplicates.sh b/t/t5308-pack-detect-duplicates.sh
index 693b2411c8..655cafa054 100755
--- a/t/t5308-pack-detect-duplicates.sh
+++ b/t/t5308-pack-detect-duplicates.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='handling of duplicate objects in incoming packfiles'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t5309-pack-delta-cycles.sh b/t/t5309-pack-delta-cycles.sh
index 55b787630f..4e910c5b9d 100755
--- a/t/t5309-pack-delta-cycles.sh
+++ b/t/t5309-pack-delta-cycles.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='test index-pack handling of delta cycles in packfiles'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t5321-pack-large-objects.sh b/t/t5321-pack-large-objects.sh
index 8a56d98a0e..70770fe274 100755
--- a/t/t5321-pack-large-objects.sh
+++ b/t/t5321-pack-large-objects.sh
@@ -6,6 +6,8 @@
test_description='git pack-object with "large" deltas
'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh