Skip to content

Commit 330ca85

Browse files
avargitster
authored andcommitted
test-tool test-hash: fix a memory leak
Fix a memory leak in "test-tool test-hash" which has been there since b57cbbf (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e4a4b31 commit 330ca85

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

t/helper/test-hash.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ int cmd_hash_impl(int ac, const char **av, int algo)
5454
fwrite(hash, 1, algop->rawsz, stdout);
5555
else
5656
puts(hash_to_hex_algop(hash, algop));
57+
free(buffer);
5758
return 0;
5859
}

t/t0015-hash.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/sh
22

33
test_description='test basic hash implementation'
4-
. ./test-lib.sh
54

5+
TEST_PASSES_SANITIZE_LEAK=true
6+
. ./test-lib.sh
67

78
test_expect_success 'test basic SHA-1 hash values' '
89
test-tool sha1 </dev/null >actual &&

t/t5308-pack-detect-duplicates.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='handling of duplicate objects in incoming packfiles'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57
. "$TEST_DIRECTORY"/lib-pack.sh
68

t/t5309-pack-delta-cycles.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='test index-pack handling of delta cycles in packfiles'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57
. "$TEST_DIRECTORY"/lib-pack.sh
68

t/t5321-pack-large-objects.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
test_description='git pack-object with "large" deltas
77
88
'
9+
10+
TEST_PASSES_SANITIZE_LEAK=true
911
. ./test-lib.sh
1012
. "$TEST_DIRECTORY"/lib-pack.sh
1113

0 commit comments

Comments
 (0)