summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2012-01-10 16:23:38 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2012-01-10 16:23:38 (GMT)
commit5540ecb72d231bbd8800195fd7924b05612017c2 (patch)
tree8710553d25dd4b2ec32090f7e06ac3b8c7b9f6df /tools/h5repack/h5repack.c
parentda199c11f4d06e253ba0970c6e9f09be732ae33b (diff)
downloadhdf5-5540ecb72d231bbd8800195fd7924b05612017c2.zip
hdf5-5540ecb72d231bbd8800195fd7924b05612017c2.tar.gz
hdf5-5540ecb72d231bbd8800195fd7924b05612017c2.tar.bz2
[svn-r21870] 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. Merged from HDF5 trunk r21869. Tested: jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE cmake), 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 c2cecf1..a475a43 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -541,9 +541,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;
@@ -573,13 +573,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);