diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2011-03-22 14:26:12 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2011-03-22 14:26:12 (GMT) |
commit | 58ca19929fd614eddee99f0cdc95551d451b4a6a (patch) | |
tree | e76e89e4f363867f12b0002c0ceb8b659138a909 /tools/lib/h5diff_attr.c | |
parent | 4674cfe1302c2ed84081c229204e923cc16ac9f8 (diff) | |
download | hdf5-58ca19929fd614eddee99f0cdc95551d451b4a6a.zip hdf5-58ca19929fd614eddee99f0cdc95551d451b4a6a.tar.gz hdf5-58ca19929fd614eddee99f0cdc95551d451b4a6a.tar.bz2 |
[svn-r20288] Purpose:
Fixed Bug 2216 - GMQS: h5diff - memory leak when compares vlen string in
dataset or attributes
Description:
Merged from HDF5 trunk r20266, r20270 and r20285.
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), Cmake - jam
Diffstat (limited to 'tools/lib/h5diff_attr.c')
-rw-r--r-- | tools/lib/h5diff_attr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 7e5fb04..097c809 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -221,12 +221,14 @@ 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 == h5tools_detect_vlen(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 == h5tools_detect_vlen(mtype2_id)) H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); HDfree(buf2); buf2 = NULL; @@ -256,12 +258,12 @@ hsize_t diff_attr(hid_t loc1_id, error: H5E_BEGIN_TRY { if(buf1) { - if(TRUE == H5Tdetect_class(mtype1_id, H5T_VLEN)) + if(TRUE == h5tools_detect_vlen(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 == h5tools_detect_vlen(mtype2_id)) H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); HDfree(buf2); } /* end if */ |