summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-05-01 05:16:50 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-05-01 05:16:50 (GMT)
commit65bb86375cfecac3e95ad1285db627a4a19eaabb (patch)
tree48151aa76db2a93929e682f3e7626d1b881364ca /src/H5O.c
parent59ea5ff28fb23ab4bd00f36da3268b2a0518c42c (diff)
downloadhdf5-65bb86375cfecac3e95ad1285db627a4a19eaabb.zip
hdf5-65bb86375cfecac3e95ad1285db627a4a19eaabb.tar.gz
hdf5-65bb86375cfecac3e95ad1285db627a4a19eaabb.tar.bz2
[svn-r383] ./src/H5A.c
./src/H5F.c ./src/H5G.c ./src/H5O.c ./src/H5Osdspace.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Z.c ./test/big.c ./test/cmpd_dset.c ./test/dsets.c ./test/extend.c ./test/istore.c Now that I have a home-grown version of Purify I fixed all the leaks in all the test files.
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 0c3a146..35dbe79 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -857,8 +857,8 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
"unable to read shared message from global heap");
}
tmp_mesg = (type->decode)(ent->file, tmp_buf, shared);
+ tmp_buf = H5MM_xfree (tmp_buf);
if (!tmp_mesg) {
- H5MM_xfree (tmp_buf);
HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL,
"unable to decode object header shared message");
}
@@ -1061,11 +1061,12 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
sh_mesg = H5MM_xcalloc (1, sizeof *sh_mesg);
if ((type->share)(ent->file, mesg, sh_mesg/*out*/)<0) {
/*
- * If the message isn't shared then turn of the shared bit
+ * If the message isn't shared then turn off the shared bit
* and treat it as an unshared message.
*/
H5E_clear ();
flags &= ~H5O_FLAG_SHARED;
+ H5MM_xfree (sh_mesg);
} else {
if (H5HG_link (ent->file, sh_mesg, 1)<0) {
HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL,
@@ -1098,6 +1099,9 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
if (flags & H5O_FLAG_SHARED) {
oh->mesg[idx].native = sh_mesg;
} else {
+ if (oh->mesg[idx].native) {
+ H5O_reset (oh->mesg[idx].type, oh->mesg[idx].native);
+ }
oh->mesg[idx].native = (type->copy) (mesg, oh->mesg[idx].native);
if (NULL == oh->mesg[idx].native) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL,
@@ -1601,8 +1605,9 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
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));
+ /* 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;