diff options
author | David Young <dyoung@hdfgroup.org> | 2020-04-06 17:32:54 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-04-06 17:32:54 (GMT) |
commit | a788202831ae8251e152edaf8dd43272e449f4c7 (patch) | |
tree | 6253cddd5bd33ca0db41917ab05c535cf92f35d9 /test | |
parent | 9678dcffbf02f3d944a16af9ec6249f5a858df75 (diff) | |
download | hdf5-a788202831ae8251e152edaf8dd43272e449f4c7.zip hdf5-a788202831ae8251e152edaf8dd43272e449f4c7.tar.gz hdf5-a788202831ae8251e152edaf8dd43272e449f4c7.tar.bz2 |
If the shadow-index size is 0 in the current step, don't calloc(3)
anything, since calloc(0, ...) is undefined.
Diffstat (limited to 'test')
-rw-r--r-- | test/vfd_swmr.c | 4 |
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); |