summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Fvfd_swmr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c
index 13170af..ebb57d6 100644
--- a/src/H5Fvfd_swmr.c
+++ b/src/H5Fvfd_swmr.c
@@ -1756,7 +1756,7 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "shadow-file allocation failed for index")
}
- new_mdf_idx = HDmalloc(new_mdf_idx_len * sizeof(new_mdf_idx[0]));
+ new_mdf_idx = H5MM_calloc(new_mdf_idx_len * sizeof(new_mdf_idx[0]));
if (new_mdf_idx == NULL) {
(void)H5MV_free(f, idx_addr, idx_size);
@@ -1774,6 +1774,12 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f)
ret_value = shared->mdf_idx = new_mdf_idx;
shared->mdf_idx_len = new_mdf_idx_len;
+ if(shared->old_mdf_idx)
+ H5MM_xfree(f->shared->old_mdf_idx);
+
+ shared->old_mdf_idx = old_mdf_idx;
+ f->shared->old_mdf_idx_len = old_mdf_idx_len;
+
/* Postpone reclamation of the old index until max_lag ticks from now.
* It's only necessary to wait until after the new index is in place,
* so it's possible that some disused shadow storage will build up