summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-06-06 18:07:09 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-06-06 18:07:09 (GMT)
commit1ccb1b3c1f1dd844944d81f193149b0ebb51e5b8 (patch)
treec9b076243a86f1af5acd840ad9b2640777fd0e80 /src/H5Dchunk.c
parentb0e79fe6dd20ec7aa1b3e5f0f8b370639a4ef5bd (diff)
downloadhdf5-1ccb1b3c1f1dd844944d81f193149b0ebb51e5b8.zip
hdf5-1ccb1b3c1f1dd844944d81f193149b0ebb51e5b8.tar.gz
hdf5-1ccb1b3c1f1dd844944d81f193149b0ebb51e5b8.tar.bz2
Made some H5O_layout_t stack allocations dynamic (quiets warnings).
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 33fc036..59227de 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -5443,7 +5443,7 @@ herr_t
H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5O_layout_t layout; /* Dataset layout message */
+ H5O_layout_t *layout = NULL; /* Dataset layout message */
hbool_t layout_read = FALSE; /* Whether the layout message was read from the file */
H5O_pline_t pline; /* I/O pipeline message */
hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */
@@ -5474,7 +5474,9 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
if((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message")
else if(exists) {
- if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, &layout))
+ if(NULL == (layout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
+ if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, layout))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message")
layout_read = TRUE;
} /* end else if */
@@ -5485,7 +5487,7 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
idx_info.f = f;
idx_info.dxpl_id = dxpl_id;
idx_info.pline = &pline;
- idx_info.layout = &layout.u.chunk;
+ idx_info.layout = &layout->u.chunk;
idx_info.storage = &storage->u.chunk;
/* Delete the chunked storage information in the file */
@@ -5498,9 +5500,12 @@ done:
if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
if(layout_read)
- if(H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
+ if(H5O_msg_reset(H5O_LAYOUT_ID, layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout message")
+ if(layout)
+ layout = (H5O_layout_t *)H5MM_xfree(layout);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_delete() */