summaryrefslogtreecommitdiffstats
path: root/src/H5Dcompact.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-10-02 20:54:51 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-10-02 20:54:51 (GMT)
commitc26ed138a65b2840c057e437fa061a4749ba7ea1 (patch)
tree6d8d51e95f944b9783020bfd2e01fcc15205fe8b /src/H5Dcompact.c
parente8e9b163c3239c2a4384c152d9c0171f4882c394 (diff)
downloadhdf5-c26ed138a65b2840c057e437fa061a4749ba7ea1.zip
hdf5-c26ed138a65b2840c057e437fa061a4749ba7ea1.tar.gz
hdf5-c26ed138a65b2840c057e437fa061a4749ba7ea1.tar.bz2
[svn-r17586] Purpose: Fix bug 1597
Description: When copying a dataset using a vlen inside a compound, the various dataset copying callbacks would allocate a background buffer but would not use it when converting from disk to memory, only memory to disk. This caused an assertion failure as compounds always need a background buffer. These callbacks have been modified to use the background buffer for both conversions. Tested: jam, linew, smirom (h5committest)
Diffstat (limited to 'src/H5Dcompact.c')
-rw-r--r--src/H5Dcompact.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index b52bd2c..33b92de 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -484,15 +484,19 @@ H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst,
HDmemcpy(buf, storage_src->buf, storage_src->size);
+ /* allocate temporary bkg buff for data conversion */
+ if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
+ /* Copy into another buffer, to reclaim memory later */
HDmemcpy(reclaim_buf, buf, buf_size);
- /* allocate temporary bkg buff for data conversion */
- if(NULL == (bkg = H5FL_BLK_CALLOC(type_conv, buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ /* Set background buffer to all zeros */
+ HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)