From 52ac74689a869b4ae40801e6096a1f037aad0081 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Tue, 9 Feb 2021 18:41:49 -0600 Subject: Check for wrap context before unwrapping file VOL object in H5F__dest (#325) --- src/H5Fint.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index df53236..67245d5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1602,8 +1602,16 @@ H5F__dest(H5F_t *f, hbool_t flush) f->open_name = (char *)H5MM_xfree(f->open_name); f->actual_name = (char *)H5MM_xfree(f->actual_name); if (f->vol_obj) { - if (NULL == H5VL_object_unwrap(f->vol_obj)) + void *vol_wrap_ctx = NULL; + + /* If a VOL wrapping context is available, retrieve it + * and unwrap file VOL object + */ + if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + if (vol_wrap_ctx && (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; -- cgit v0.12