Skip to content

Commit 6a75658

Browse files
avargitster
authored andcommitted
tests: fix a memory leak in test-prio-queue.c
Fix a memory leak in t/helper/test-prio-queue.c, the lack of freeing the memory with clear_prio_queue() has been there ever since this code was originally added in b4b594a (prio-queue: priority queue of pointers to structs, 2013-06-06). By fixing this leak we can cleanly run t0009-prio-queue.sh under SANITIZE=leak, so annotate it as such with TEST_PASSES_SANITIZE_LEAK=true. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6cb3deb commit 6a75658

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

t/helper/test-prio-queue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ int cmd__prio_queue(int argc, const char **argv)
4646
}
4747
}
4848

49+
clear_prio_queue(&pq);
50+
4951
return 0;
5052
}

t/t0009-prio-queue.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='basic tests for priority queue implementation'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57

68
cat >expect <<'EOF'

0 commit comments

Comments
 (0)