diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2019-06-19 21:43:23 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2019-06-19 21:43:23 (GMT) |
commit | 246b40f8f815308b929e55279e30887ffec7b8e4 (patch) | |
tree | c4e1c262f112a498aeb54090d90e39f97ffca026 /src/H5S.c | |
parent | 82f656aed0beed3b40e682f51e979e8e20ccde74 (diff) | |
parent | ca1ee7fae118c8d4137b1b5efe57660d2e0ff9b1 (diff) | |
download | hdf5-246b40f8f815308b929e55279e30887ffec7b8e4.zip hdf5-246b40f8f815308b929e55279e30887ffec7b8e4.tar.gz hdf5-246b40f8f815308b929e55279e30887ffec7b8e4.tar.bz2 |
Merge pull request #6 in ~VCHOI/my_third_fork from develop to bugfix/new_shutdown_fsm
* commit 'ca1ee7fae118c8d4137b1b5efe57660d2e0ff9b1': (64 commits)
Fix memory leak in objcopy test after H5Aread of vlen data
HDFFV-10616 add h5fc script
Fixed a problem in the ohdr test where hard-coded strings passed to H5Awrite() triggered -fsanitize failures.
Yanked qsort assert
Switched to HGOTO_DONE() in the links code.
Updated the HDqsort() macro to ensure we don't pass NULL buffers to qsort(3) in the future.
Fixed a bug in the links code where iterating over an empty group would pass a NULL pointer to qsort(3), which is undefined behavior.
Reset the other convenience pointer because why no
Fixed a memory bug where a pointer is used after it's been freed.
fixed pass_through vol
HDFFV-10805 Add option to only build shared targets
Fixed a warning in H5CX.c concerning incorrect use of freeing VOL connector info.
Add H5S_SEL_ITER_SHARE_WITH_DATASPACE selection iterator creation flag, to share dataspace's selection with iterator (and with caution about not modifying or closing the dataspace while the iterator is open).
Added a warning summary script for gcc to bin
Fix misc. typos, etc. from code review
Fixed problem with H5Fdelete "test" and split VFD.
New hyperslab selection routines and new public selection iterator routines.
Added the creation and use of an attribute access property list to testhdf5.
Update MANIFEST for move of h5cc.in and h5redeploy.in to bin directory.
Added missing DELETE enum value.
...
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -93,6 +93,14 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; +/* Dataspace selection iterator ID class */ +static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{ + H5I_SPACE_SEL_ITER, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */ +}}; + /* Flag indicating "top" of interface has been initialized */ static hbool_t H5S_top_package_initialize_s = FALSE; @@ -120,6 +128,10 @@ H5S__init_package(void) if(H5I_register_type(H5I_DATASPACE_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") + /* Initialize the atom group for the dataspace selction iterator IDs */ + if(H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class") + /* Mark "top" of interface as initialized, too */ H5S_top_package_initialize_s = TRUE; @@ -159,6 +171,11 @@ H5S_top_term_package(void) n++; /*H5I*/ } /* end if */ + if(H5I_nmembers(H5I_SPACE_SEL_ITER) > 0) { + (void)H5I_clear_type(H5I_SPACE_SEL_ITER, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ + /* Mark "top" of interface as closed */ if(0 == n) H5S_top_package_initialize_s = FALSE; @@ -198,11 +215,15 @@ H5S_term_package(void) if(H5_PKG_INIT_VAR) { /* Sanity checks */ HDassert(0 == H5I_nmembers(H5I_DATASPACE)); + HDassert(0 == H5I_nmembers(H5I_SPACE_SEL_ITER)); HDassert(FALSE == H5S_top_package_initialize_s); /* Destroy the dataspace object id group */ n += (H5I_dec_type_ref(H5I_DATASPACE) > 0); + /* Destroy the dataspace selection iterator object id group */ + n += (H5I_dec_type_ref(H5I_SPACE_SEL_ITER) > 0); + /* Mark interface as closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; @@ -448,10 +469,14 @@ H5S_close(H5S_t *ds) if(H5S__extent_release(&ds->extent) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") - /* Release the main structure */ - ds = H5FL_FREE(H5S_t, ds); - done: + /* Release the main structure. + * Always do this to ensure that we don't leak memory when calling this + * function on partially constructed dataspaces (which will fail one or + * both of the above calls) + */ + H5FL_FREE(H5S_t, ds); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_close() */ |