summaryrefslogtreecommitdiffstats
path: root/src/H5Z.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Z.c')
-rw-r--r--src/H5Z.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/H5Z.c b/src/H5Z.c
index ef34d7c..de84a9e 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -811,8 +811,9 @@ done:
static herr_t
H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
{
- hid_t space_id = -1; /* ID for dataspace describing chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t space_id = -1; /* ID for dataspace describing chunk */
+ H5O_layout_t *dcpl_layout = NULL; /* Dataset's layout information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -822,18 +823,20 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
/* Check if the property list is non-default */
if(dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
H5P_genplist_t *dc_plist; /* Dataset creation property list object */
- H5O_layout_t dcpl_layout; /* Dataset's layout information */
+
+ if(NULL == (dcpl_layout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
/* Get dataset creation property list object */
if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Peek at the layout information */
- if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
+ if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
/* Check if the dataset is chunked */
- if(H5D_CHUNKED == dcpl_layout.type) {
+ if(H5D_CHUNKED == dcpl_layout->type) {
H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */
/* Get I/O pipeline information */
@@ -847,9 +850,9 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
size_t u; /* Local index variable */
/* Create a data space for a chunk & set the extent */
- for(u = 0; u < dcpl_layout.u.chunk.ndims; u++)
- chunk_dims[u] = dcpl_layout.u.chunk.dim[u];
- if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL)))
+ for(u = 0; u < dcpl_layout->u.chunk.ndims; u++)
+ chunk_dims[u] = dcpl_layout->u.chunk.dim[u];
+ if(NULL == (space = H5S_create_simple(dcpl_layout->u.chunk.ndims, chunk_dims, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Get ID for dataspace to pass to filter routines */
@@ -868,6 +871,8 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
done:
if(space_id > 0 && H5I_dec_ref(space_id) < 0)
HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
+ if(dcpl_layout)
+ dcpl_layout = (H5O_layout_t *)H5MM_xfree(dcpl_layout);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_prepare_prelude_callback_dcpl() */