summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2012-01-09 21:24:50 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2012-01-09 21:24:50 (GMT)
commit00b9f24d9b161817876921a8bd983ed1d148def1 (patch)
treec57416b820a40440905528abe5b3b62c51495f1b /tools/h5repack/h5repack.c
parente0db7c89228e73cd3e30604f4987ee3146a8380f (diff)
downloadhdf5-00b9f24d9b161817876921a8bd983ed1d148def1.zip
hdf5-00b9f24d9b161817876921a8bd983ed1d148def1.tar.gz
hdf5-00b9f24d9b161817876921a8bd983ed1d148def1.tar.bz2
[svn-r21869] Purpose:
Fix for HDFFV-7840 h5repack: memory leak over one of the h5diff test file Description: Turned out that there were two causes of memory leaks. 1. for handling variable length string in attribute. 2. for handling compound type with non-reference members. The first issue is fixed in copy_attr() which is updated to use h5tools_detect_vlen to take care of vlen string as well as vlen data. The second is fixed in copy_refs_attr() of compound handling code. Tested: jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE), Cmake (jam)
Diffstat (limited to 'tools/h5repack/h5repack.c')
-rw-r--r--tools/h5repack/h5repack.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 1f42eef..a5fb47f 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -544,9 +544,9 @@ int copy_attr(hid_t loc_in,
if(H5Aclose(attr_out) < 0)
goto error;
- /* Check if we have VL data in the attribute's datatype that must
+ /* Check if we have VL data and string in the attribute's datatype that must
* be reclaimed */
- if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if (TRUE == h5tools_detect_vlen(wtype_id))
H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
HDfree(buf);
buf = NULL;
@@ -576,13 +576,13 @@ int copy_attr(hid_t loc_in,
error:
H5E_BEGIN_TRY {
if(buf) {
- /* Check if we have VL data in the attribute's datatype that must
+ /* Check if we have VL data and string in the attribute's datatype that must
* be reclaimed */
- if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if (TRUE == h5tools_detect_vlen(wtype_id))
H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
/* Free buf */
- free(buf);
+ HDfree(buf);
} /* end if */
H5Tclose(ftype_id);