From 099e781c6112eb3afb66264ccb3644627d3983e0 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 21 Apr 2003 13:30:09 -0500 Subject: [PATCH] [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: --- src/H5F.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/H5F.c b/src/H5F.c index 38b90f8f4e..c7531807e9 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");