diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-23 20:40:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-23 20:40:14 (GMT) |
commit | e40557304fcfc662bb1a445abca516ee4b246d94 (patch) | |
tree | c9f1692443a62e0c481c7c0278e39d7b83d1b419 /src/H5Distore.c | |
parent | 1062b4f9d7080a3e439df7d3d527aee43f96d085 (diff) | |
download | hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.zip hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.gz hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.bz2 |
[svn-r12803] Description:
Finish new version of the I/O pipeline message, which is much smaller than
the previous version. This version is used with the "use the latest version
of the format" flag.
Closed several memory leaks/overruns (found with valgrind).
Also, lots of compiler & formatting cleanups.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Distore.c')
-rw-r--r-- | src/H5Distore.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c index 8518763..e4e9eee 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1034,6 +1034,14 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, /* Re-allocate memory for copying the chunk */ if(NULL == (udata->buf = H5MM_realloc(udata->buf, nbytes))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed for raw data chunk") + if(udata->bkg) { + if(NULL == (udata->bkg = H5MM_realloc(udata->bkg, nbytes))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed for raw data chunk") + if(!udata->cpy_info->expand_ref) + HDmemset((uint8_t *)udata->bkg + buf_size, 0, (size_t)(nbytes - buf_size)); + + bkg = udata->bkg; + } /* end if */ buf = udata->buf; udata->buf_size = buf_size = nbytes; @@ -1044,7 +1052,7 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, HGOTO_ERROR(H5E_IO, H5E_READERROR, H5B_ITER_ERROR, "unable to read raw data chunk") /* Need to uncompress variable-length & reference data elements */ - if(is_compressed && (is_vlen | fix_ref)) { + if(is_compressed && (is_vlen || fix_ref)) { unsigned filter_mask = lt_key->filter_mask; if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, edc_read, cb_struct, &nbytes, &buf_size, &buf) < 0) @@ -3651,6 +3659,13 @@ H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") } /* end if */ else { + /* Create datatype ID for source datatype, so it gets freed */ + if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) { + /* Create datatype ID for src datatype */ + if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype") + } /* end if */ + buf_size = layout_src->u.chunk.size; reclaim_buf_size = 0; } /* end else */ @@ -3700,8 +3715,9 @@ H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, if(H5B_iterate(f_src, dxpl_id, H5B_ISTORE, H5D_istore_iter_copy, layout_src->u.chunk.addr, &udata) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") - /* I/O buffer may have been re-allocated */ + /* I/O buffers may have been re-allocated */ buf = udata.buf; + bkg = udata.bkg; done: if(sid_buf > 0) |