diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-20 21:37:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-20 21:37:12 (GMT) |
commit | 47c3bc7540869f53f0b734c68d3289835f0a546d (patch) | |
tree | 90e688dc21b095d9d3d36e944465ac79eff05348 /src/H5Ocopy.c | |
parent | b2012d9f74843ec87b31b7aca0c3ad8b6b6fe448 (diff) | |
download | hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.zip hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.tar.gz hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.tar.bz2 |
[svn-r19272] Description:
Close out various resource leaks and usages of uninitialized memory that
were flagged by valgrind. [There's still some more valgrind warnings, but
it's better now... :-/ ]
Also clean up warnings and code formatting.
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug & valgrind
(h5committest forthcoming)
Diffstat (limited to 'src/H5Ocopy.c')
-rw-r--r-- | src/H5Ocopy.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 8e55503..7a10765 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -575,7 +575,15 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, addr_new = oh_dst->chunk[0].addr; /* Create memory image for the new chunk */ - if(NULL == (oh_dst->chunk[0].image = H5FL_BLK_MALLOC(chunk_image, (size_t)dst_oh_size))) + /* Note: we use calloc() instead of malloc() here because older versions of + * some messages don't initialize "unused" bytes and because we want to + * write out the same version of the object header and older versions of + * object headers aligned messages. In both those situations, it's + * complex and error-prone to determine all the proper ways/places to + * clear to zero bytes, so we just set the buffer to zero's here. + * (QAK - 2010/08/17) + */ + if(NULL == (oh_dst->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, (size_t)dst_oh_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set dest. chunk information */ |