summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/vfd_swmr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c
index 1be1aba..6e7428e 100644
--- a/test/vfd_swmr.c
+++ b/test/vfd_swmr.c
@@ -2718,8 +2718,8 @@ test_shadow_index_lookup(void)
assert(modulus > 1); // so that modulus - 1 > 0, below
- idx = calloc(cursize, sizeof(*idx));
- if (idx == NULL) {
+ idx = (cursize == 0) ? NULL : calloc(cursize, sizeof(*idx));
+ if (idx == NULL && cursize != 0) {
fprintf(stderr, "couldn't allocate %" PRIu32 " indices\n",
cursize);
exit(EXIT_FAILURE);