summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-04-21 18:30:09 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-04-21 18:30:09 (GMT)
commit099e781c6112eb3afb66264ccb3644627d3983e0 (patch)
tree4ee8c755cca131c6883a6d8836569e52ae36358a /src
parent9e3ab7e5d2494ca4dda3b3b2e9984eb067abb649 (diff)
downloadhdf5-099e781c6112eb3afb66264ccb3644627d3983e0.zip
hdf5-099e781c6112eb3afb66264ccb3644627d3983e0.tar.gz
hdf5-099e781c6112eb3afb66264ccb3644627d3983e0.tar.bz2
[svn-r6719] Purpose:
Bug Fix Description: A resource leak happened if the H5Fget_access_plist() function was called. What was happening: the driver ID and info parts of the property list copied in H5Fget_access_plist were being overwritten, but those properties were copied initially, so we lost information. Solution: Before copying over those values, call the H5F_acs_close() function to close those values. Platforms tested: Modi4 (Parallel & Fortran) Arabica (Fortran) Verbena (Fortran & C++) Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 38b90f8..c753180 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -903,10 +903,18 @@ H5Fget_access_plist(hid_t file_id)
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->lf->def_sdata_block_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size");
+ /*
+ * Since we're resetting the driver ID and info, close them if they
+ * exist in this new property list.
+ */
+ if (H5F_acs_close(ret_value, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information");
+
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID");
driver_info = H5FD_fapl_get(f->shared->lf);
+
if(driver_info != NULL && H5P_set(new_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver info");