summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff_attr.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-03-17 23:00:14 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-03-17 23:00:14 (GMT)
commite8d97aef7dfda3da6ceb599828fd641fa26cd8a9 (patch)
treed3a4074e3b34a8b444854f4c93e0bbbdecb35cf0 /tools/lib/h5diff_attr.c
parente54ede09769b614f82c70236e17a542d674f9724 (diff)
downloadhdf5-e8d97aef7dfda3da6ceb599828fd641fa26cd8a9.zip
hdf5-e8d97aef7dfda3da6ceb599828fd641fa26cd8a9.tar.gz
hdf5-e8d97aef7dfda3da6ceb599828fd641fa26cd8a9.tar.bz2
[svn-r20266] Purpose:
Fixed Bug 2216 - GMQS: h5diff - memory leak when compares vlen string in dataset or attributes Description: Test for dataset : valgrind --leak-check=full ./h5diff -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/VLstring Test for attr : valgrind --leak-check=full ./h5diff h5diff_attr1.h5 h5diff_attr2.h5 Both test cases are in testing script. Tested: jam (linux32-LE), amani (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Cmake - jam
Diffstat (limited to 'tools/lib/h5diff_attr.c')
-rw-r--r--tools/lib/h5diff_attr.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 7e5fb04..1742028 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -221,12 +221,16 @@ hsize_t diff_attr(hid_t loc1_id,
*----------------------------------------------------------------------
*/
- /* Free buf1 and buf2, being careful to reclaim any VL data first */
- if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN))
+ /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
+ * VLEN memory first */
+ if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN) ||
+ TRUE == h5tools_detect_vlen_str(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
+
buf1 = NULL;
- if(TRUE == H5Tdetect_class(mtype2_id, H5T_VLEN))
+ if(TRUE == H5Tdetect_class(mtype2_id, H5T_VLEN) ||
+ TRUE == h5tools_detect_vlen_str(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
buf2 = NULL;
@@ -256,12 +260,14 @@ hsize_t diff_attr(hid_t loc1_id,
error:
H5E_BEGIN_TRY {
if(buf1) {
- if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN))
+ if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN) ||
+ TRUE == h5tools_detect_vlen_str(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
} /* end if */
if(buf2) {
- if(TRUE == H5Tdetect_class(mtype2_id, H5T_VLEN))
+ if(TRUE == H5Tdetect_class(mtype2_id, H5T_VLEN) ||
+ TRUE == h5tools_detect_vlen_str(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
} /* end if */