summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-03-21 23:20:22 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-03-21 23:20:22 (GMT)
commit4674cfe1302c2ed84081c229204e923cc16ac9f8 (patch)
treef27341e041237a39f0e8752759dfbdbb74be1470 /tools/lib/h5diff.c
parent64a17e9f7c7759bc6971219dd26491dac4674b86 (diff)
downloadhdf5-4674cfe1302c2ed84081c229204e923cc16ac9f8.zip
hdf5-4674cfe1302c2ed84081c229204e923cc16ac9f8.tar.gz
hdf5-4674cfe1302c2ed84081c229204e923cc16ac9f8.tar.bz2
[svn-r20286] Purpose:
Fixed Bug 2214 - GMQS: h5diff - memory leak when accessing symbolic links with --follow-symlinks option and the target type is UDLink or some error occurs Description: Merged from HDF5 trunk r20274. Memory leaks occurred when accessing symbolic links with --follow-symlink option. Test cases are in testing script. (400 - 456, 501 - 518) An example test : valgrind --leak-check=full h5diff --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 Tested: jam (linux32-LE), amani (linux64-LE), heiwa (linuxppc64-BE), Cmake - jam
Diffstat (limited to 'tools/lib/h5diff.c')
-rw-r--r--tools/lib/h5diff.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 5f406cf..a616dba 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1958,9 +1958,6 @@ hsize_t diff(hid_t file1_id,
if(options->m_verbose)
print_found(nfound);
- /* free link info buffer */
- HDfree(linkinfo1.trg_path);
- HDfree(linkinfo2.trg_path);
}
break;
@@ -2007,10 +2004,6 @@ hsize_t diff(hid_t file1_id,
file2_id, path2,
options, linkinfo1.trg_type);
}
-
- /* free link info buffer */
- HDfree(linkinfo1.trg_path);
- HDfree(linkinfo2.trg_path);
} /* end if */
else
{
@@ -2045,6 +2038,12 @@ hsize_t diff(hid_t file1_id,
break;
}
+ /* free link info buffer */
+ if (linkinfo1.trg_path)
+ HDfree(linkinfo1.trg_path);
+ if (linkinfo2.trg_path)
+ HDfree(linkinfo2.trg_path);
+
return nfound;
out: