summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5S.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 9ca8436..875cd56 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -308,7 +308,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
- if(!dest && NULL == (dest = H5FL_MALLOC(H5S_extent_t)))
+ if(!dest && NULL == (dest = H5FL_CALLOC(H5S_extent_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
@@ -463,7 +463,7 @@ H5O_sdspace_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src,
*/
if(udata) {
/* Allocate copy of dataspace extent */
- if(NULL == (udata->src_space_extent = H5FL_MALLOC(H5S_extent_t)))
+ if(NULL == (udata->src_space_extent = H5FL_CALLOC(H5S_extent_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
diff --git a/src/H5S.c b/src/H5S.c
index 1146ab4..346e908 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -509,6 +509,10 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
FUNC_ENTER_NOAPI(FAIL)
+ /* Release destination extent before we copy over it */
+ if(H5S_extent_release(dst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
+
/* Copy the regular fields */
dst->type = src->type;
dst->version = src->version;
@@ -583,7 +587,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
FUNC_ENTER_NOAPI(NULL)
- if(NULL == (dst = H5FL_MALLOC(H5S_t)))
+ if(NULL == (dst = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */