summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-03-13 15:06:10 +1100
committerDamien George <damien.p.george@gmail.com>2020-03-26 01:21:04 +1100
commitf9741d18f6ad8c1aeff93109bda30ff99a687766 (patch)
tree456418ca4f921a3f019188c9b9079bf31c74ff49
parent6c7e78de7223c60f4b762e8b4d33f754d65921d8 (diff)
unix/coverage: Init all pairheap test nodes before using them.
-rw-r--r--ports/unix/coverage.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c
index 59fcf5524..7169c7793 100644
--- a/ports/unix/coverage.c
+++ b/ports/unix/coverage.c
@@ -149,6 +149,9 @@ STATIC int pairheap_lt(mp_pairheap_t *a, mp_pairheap_t *b) {
// ops array contain operations: x>=0 means push(x), x<0 means delete(-x)
STATIC void pairheap_test(size_t nops, int *ops) {
mp_pairheap_t node[8];
+ for (size_t i = 0; i < MP_ARRAY_SIZE(node); ++i) {
+ mp_pairheap_init_node(pairheap_lt, &node[i]);
+ }
mp_pairheap_t *heap = mp_pairheap_new(pairheap_lt);
printf("create:");
for (size_t i = 0; i < nops; ++i) {