summaryrefslogtreecommitdiffstats
path: root/src/H5Dfarray.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/H5Dfarray.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/H5Dfarray.c')
-rw-r--r--src/H5Dfarray.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index d183a8c..b4bd6d6 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -36,6 +36,7 @@
#include "H5FAprivate.h" /* Fixed arrays */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vector functions */
@@ -469,7 +470,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
H5O_loc_t obj_loc; /* Pointer to an object's location */
hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
- H5O_layout_t layout; /* Layout message */
+ H5O_layout_t *layout = NULL; /* Layout message */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -493,7 +494,9 @@ H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
obj_opened = TRUE;
/* Read the layout message */
- if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id))
+ if(NULL == (layout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't get memory for layout")
+ if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, layout, dxpl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
/* close the object header */
@@ -502,7 +505,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
/* Create user data */
dbg_ctx->f = f;
- dbg_ctx->chunk_size = layout.u.chunk.size;
+ dbg_ctx->chunk_size = layout->u.chunk.size;
/* Set return value */
ret_value = dbg_ctx;
@@ -521,6 +524,9 @@ done:
} /* end if */
} /* end if */
+ if(layout)
+ layout = (H5O_layout_t *)H5MM_xfree(layout);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_crt_dbg_context() */