summaryrefslogtreecommitdiffstats
path: root/src/H5Fint.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2021-02-06 14:20:49 (GMT)
committerGitHub <noreply@github.com>2021-02-06 14:20:49 (GMT)
commit2b4b8e8423bcbbc25df3c5d262bf310703e78f1b (patch)
treed380e77a1888d75d50984f209065a597951fae3d /src/H5Fint.c
parentb3934e99ebecee285cb63f07cc793d40323ffe33 (diff)
downloadhdf5-2b4b8e8423bcbbc25df3c5d262bf310703e78f1b.zip
hdf5-2b4b8e8423bcbbc25df3c5d262bf310703e78f1b.tar.gz
hdf5-2b4b8e8423bcbbc25df3c5d262bf310703e78f1b.tar.bz2
Unwrap file VOL object when destroying file (#308)
Diffstat (limited to 'src/H5Fint.c')
-rw-r--r--src/H5Fint.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 464d531..df53236 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -247,7 +247,8 @@ H5F__close_cb(H5VL_object_t *file_vol_obj, void **request)
if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
- /* Free the VOL object */
+ /* Free the VOL object; it is unnecessary to unwrap the VOL
+ * object before freeing it, as the object was not wrapped */
if (H5VL_free_object(file_vol_obj) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
@@ -1320,6 +1321,8 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F
done:
if (!ret_value && f) {
+ HDassert(NULL == f->vol_obj);
+
if (!shared) {
/* Attempt to clean up some of the shared file structures */
if (f->shared->efc)
@@ -1332,11 +1335,6 @@ done:
f->shared = H5FL_FREE(H5F_shared_t, f->shared);
}
- /* Free VOL object */
- if (f->vol_obj)
- if (H5VL_free_object(f->vol_obj) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "unable to free VOL object")
-
f = H5FL_FREE(H5F_t, f);
}
@@ -1603,9 +1601,13 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Free the non-shared part of the file */
f->open_name = (char *)H5MM_xfree(f->open_name);
f->actual_name = (char *)H5MM_xfree(f->actual_name);
- if (f->vol_obj && H5VL_free_object(f->vol_obj) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
- f->vol_obj = NULL;
+ if (f->vol_obj) {
+ if (NULL == H5VL_object_unwrap(f->vol_obj))
+ HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object")
+ if (H5VL_free_object(f->vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ f->vol_obj = NULL;
+ }
if (H5FO_top_dest(f) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
f->shared = NULL;