summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-04-30 13:35:45 (GMT)
committerGitHub <noreply@github.com>2022-04-30 13:35:45 (GMT)
commit7e586e0e4416a27f119a17332330463c4c501c95 (patch)
treeda9bce5e384989229668386558ea02baa4269396 /src
parentc4d70e3571262df0fcf381f5804b671dc9f86bc1 (diff)
downloadhdf5-7e586e0e4416a27f119a17332330463c4c501c95.zip
hdf5-7e586e0e4416a27f119a17332330463c4c501c95.tar.gz
hdf5-7e586e0e4416a27f119a17332330463c4c501c95.tar.bz2
Fix SWMR/refresh bug hidden by library free lists (#1702)
Diffstat (limited to 'src')
-rw-r--r--src/H5Oflush.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index d7c7c02..116a04b 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -194,8 +194,9 @@ done:
herr_t
H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
{
- H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
- hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */
+ H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
+ hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */
+ H5F_t * file = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -208,6 +209,11 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
H5O_shared_t cached_H5O_shared;
H5VL_t * connector = NULL;
+ /* Hold a copy of the object's file pointer, since closing the object will
+ * invalidate the file pointer in the oloc.
+ */
+ file = oloc->file;
+
/* Create empty object location */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
@@ -256,8 +262,8 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
} /* end if */
done:
- if (objs_incr)
- H5F_decr_nopen_objs(oloc->file);
+ if (objs_incr && file)
+ H5F_decr_nopen_objs(file);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_refresh_metadata() */