summaryrefslogtreecommitdiffstats
path: root/src/H5Olayout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r--src/H5Olayout.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index e4257c9..ebae1fb 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -374,8 +374,10 @@ H5O_layout_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
+
+ /* Allocate destination message, if necessary */
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "layout message allocation failed")
/* copy */
*dest = *mesg;
@@ -398,6 +400,10 @@ H5O_layout_copy(const void *_mesg, void *_dest)
ret_value = dest;
done:
+ if(ret_value == NULL)
+ if(NULL == _dest)
+ dest = H5FL_FREE(H5O_layout_t, dest);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_copy() */