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>
Ævar Arnfjörð Bjarmason committed
Jul 1, 2022 at 12:37 UTC
330ca8501b6b4cb7afec20dc0b9513542118e9de
5 files changed
+9
-1
t/helper/test-hash.c
+1
@@ -54,5 +54,6 @@ int cmd_hash_impl(int ac, const char **av, int algo)
54
fwrite(hash, 1, algop->rawsz, stdout);
55
else
56
puts(hash_to_hex_algop(hash, algop));
57
+ free(buffer);
58
return 0;
59
}
t/t0015-hash.sh
+2
-1
@@ -1,8 +1,9 @@
1
#!/bin/sh
2
3
test_description='test basic hash implementation'
4
-. ./test-lib.sh
4
5
+TEST_PASSES_SANITIZE_LEAK=true
6
+. ./test-lib.sh
7
8
test_expect_success 'test basic SHA-1 hash values' '
9
test-tool sha1 </dev/null >actual &&
t/t5308-pack-detect-duplicates.sh
+2
@@ -1,6 +1,8 @@
1
#!/bin/sh
2
3
test_description='handling of duplicate objects in incoming packfiles'
4
+
5
+TEST_PASSES_SANITIZE_LEAK=true
6
. ./test-lib.sh
7
. "$TEST_DIRECTORY"/lib-pack.sh
8
t/t5309-pack-delta-cycles.sh
+2
@@ -1,6 +1,8 @@
1
#!/bin/sh
2
3
test_description='test index-pack handling of delta cycles in packfiles'
4
+
5
+TEST_PASSES_SANITIZE_LEAK=true
6
. ./test-lib.sh
7
. "$TEST_DIRECTORY"/lib-pack.sh
8
t/t5321-pack-large-objects.sh
+2
@@ -6,6 +6,8 @@
6
test_description='git pack-object with "large" deltas
7
8
'
9
+
10
+TEST_PASSES_SANITIZE_LEAK=true
11
. ./test-lib.sh
12
. "$TEST_DIRECTORY"/lib-pack.sh
13