diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index ff42b3646ee..295277df2b6 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -541,12 +541,6 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_ (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start)); } - if (H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv)) { - memset(tmp_buf, 0, - smine_nelmts * - MAX(dset_info->type_info.src_type_size, dset_info->type_info.dst_type_size)); - } - /* * Gather the data from disk into the datatype conversion * buffer. Also gather data from application to background buffer @@ -560,7 +554,8 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_ n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, io_info->bkg_buf /*out*/); if (n != smine_nelmts) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed"); - } + } else +memset(tmp_buf, 0, smine_nelmts * MAX(dset_info->type_info.src_type_size, dset_info->type_info.dst_type_size)); /* * Gather data diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 6fd67d05d58..aff2ec5480e 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -343,13 +343,13 @@ test_select_src_subset(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fill goto error; /* Allocate space and initialize data */ - rbuf = (unsigned char *)malloc(NX * NY * sizeof(stype3)); + rbuf = (unsigned char *)calloc(NX * NY, sizeof(stype3)); - rew_buf = (unsigned char *)malloc(NX * NY * sizeof(stype3)); + rew_buf = (unsigned char *)calloc(NX * NY, sizeof(stype3)); initialize_stype3(rew_buf, (size_t)NX * NY); /* Save a copy as the buffer may be clobbered due to H5Pset_modify_write_buf() */ - save_rew_buf = (unsigned char *)malloc(NX * NY * sizeof(stype3)); + save_rew_buf = (unsigned char *)calloc(NX * NY, sizeof(stype3)); initialize_stype3(save_rew_buf, (size_t)NX * NY); /* Create dataset creation property list */ @@ -639,15 +639,15 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva hsize_t memb_size[1] = {4}; /* Allocate buffers */ - if (NULL == (s1 = (s1_t *)malloc(sizeof(s1_t) * NX * NY))) + if (NULL == (s1 = (s1_t *)calloc(NX * NY, sizeof(s1_t)))) goto error; - if (NULL == (rbuf1 = (s1_t *)malloc(sizeof(s1_t) * NX * NY))) + if (NULL == (rbuf1 = (s1_t *)calloc(NX * NY, sizeof(s1_t)))) goto error; - if (NULL == (s3 = (s3_t *)malloc(sizeof(s3_t) * NX * NY))) + if (NULL == (s3 = (s3_t *)calloc(NX * NY, sizeof(s3_t)))) goto error; - if (NULL == (save_s3 = (s3_t *)malloc(sizeof(s3_t) * NX * NY))) + if (NULL == (save_s3 = (s3_t *)calloc(NX * NY, sizeof(s3_t)))) goto error; - if (NULL == (rbuf3 = (s3_t *)malloc(sizeof(s3_t) * NX * NY))) + if (NULL == (rbuf3 = (s3_t *)calloc(NX * NY, sizeof(s3_t)))) goto error; /* Create the file */