diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-23 20:56:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-23 20:56:42 (GMT) |
commit | 0f95a9d5ab47a609f50c7554e46f60b625df07e8 (patch) | |
tree | 2137e981bc20f6e3f40176487780a9032936d228 /src/H5HLcache.c | |
parent | 65996f2921391c653d05ad92b7b62ba27f3c2bdd (diff) | |
download | hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.zip hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.gz hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.bz2 |
[svn-r19278] Description:
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.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 51d60f9..56d9919 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -440,10 +440,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); |