summaryrefslogtreecommitdiffstats
path: root/src/H5HLcache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-24 00:33:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-24 00:33:09 (GMT)
commite5d9761abad0b613eaa99b7bbced6cad20e917bd (patch)
tree44ea85c659cb25f3f1a93392f1d703953120461a /src/H5HLcache.c
parent3de1ecd9c8f376523f4d4fe5a5c2f265e246bdde (diff)
downloadhdf5-e5d9761abad0b613eaa99b7bbced6cad20e917bd.zip
hdf5-e5d9761abad0b613eaa99b7bbced6cad20e917bd.tar.gz
hdf5-e5d9761abad0b613eaa99b7bbced6cad20e917bd.tar.bz2
[svn-r19283] Description:
Bring r19278 from trunk to 1.8 branch: More fixes to memory allocation, etc. exposed by valgrind. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5HLcache.c')
-rw-r--r--src/H5HLcache.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 6c5c5d2..01532ca 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -438,10 +438,16 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Check if the local heap is a single object in cache */
if(heap->single_cache_obj) {
- /* Set p to the start of the data block. This is necessary because
- * there may be a gap between the used portion of the prefix and the
- * data block due to alignment constraints. */
- p = buf + heap->prfx_size;
+ if((p - buf) < heap->prfx_size) {
+ size_t gap; /* Size of gap between prefix and data block */
+
+ /* Set p to the start of the data block. This is necessary because
+ * there may be a gap between the used portion of the prefix and the
+ * data block due to alignment constraints. */
+ gap = heap->prfx_size - (p - buf);
+ HDmemset(p, 0, gap);
+ p += gap;
+ } /* end if */
/* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap);