summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-04-28 16:37:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-04-28 16:37:17 (GMT)
commitdce73e919fc77959ed7653b0ab330a6952494547 (patch)
tree032dbc23b510e29407b70b3dc5636d3de547853b /src/H5O.c
parent66071d5078ad9841c8fbb430881ae2c6e059886e (diff)
downloadhdf5-dce73e919fc77959ed7653b0ab330a6952494547.zip
hdf5-dce73e919fc77959ed7653b0ab330a6952494547.tar.gz
hdf5-dce73e919fc77959ed7653b0ab330a6952494547.tar.bz2
[svn-r378] Merged Robb's and my memory leak fixes into one set of common fixes.
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/H5O.c b/src/H5O.c
index bdf2efd..0c3a146 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1448,9 +1448,13 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
* that could be generated below.
*/
if (oh->nmesgs + 3 > oh->alloc_nmesgs) {
- oh->alloc_nmesgs += MAX(H5O_NMESGS, 3);
- oh->mesg = H5MM_xrealloc(oh->mesg,
+ int old_alloc=oh->alloc_nmesgs;
+
+ oh->alloc_nmesgs += MAX(H5O_NMESGS, 3);
+ oh->mesg = H5MM_xrealloc(oh->mesg,
oh->alloc_nmesgs * sizeof(H5O_mesg_t));
+ /* Set new object header info to zeros */
+ HDmemset(&oh->mesg[old_alloc],0,(oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t));
}
/*
@@ -1592,9 +1596,13 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
assert(oh->mesg[idx].raw_size - size >= H5O_SIZEOF_MSGHDR(f));
if (oh->nmesgs >= oh->alloc_nmesgs) {
+ int old_alloc=oh->alloc_nmesgs;
+
oh->alloc_nmesgs += H5O_NMESGS;
oh->mesg = H5MM_xrealloc(oh->mesg,
oh->alloc_nmesgs * sizeof(H5O_mesg_t));
+ /* Set new object header info to zeros */
+ HDmemset(&oh->mesg[old_alloc],0,(oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t));
}
null_idx = oh->nmesgs++;
oh->mesg[null_idx].type = H5O_NULL;