summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2020-04-02 03:14:42 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2020-04-02 03:14:42 (GMT)
commitbae05235a2d87acb0d6b3a2e1c32f3b6f48cf203 (patch)
treefcd82c20fec3b44713680b676e499080df991afc /src
parent281e8444d862991aeca1a28e42e387a627bc362b (diff)
parentafdcac28b85d690eebc80ab568fa5266081baaaa (diff)
downloadhdf5-bae05235a2d87acb0d6b3a2e1c32f3b6f48cf203.zip
hdf5-bae05235a2d87acb0d6b3a2e1c32f3b6f48cf203.tar.gz
hdf5-bae05235a2d87acb0d6b3a2e1c32f3b6f48cf203.tar.bz2
Merge pull request #2461 in HDFFV/hdf5 from ~VCHOI/my_third_fork:bugfix/dtype_close_on_error to develop
* commit 'afdcac28b85d690eebc80ab568fa5266081baaaa': A fix in the cleaning up code for datatype when datatype initialization via H5D__init_type() fails. This is triggered by the tests for revised references when the libver bounds setting does not allow version 4 datatype message to be created. The test failure is abort core dumped. This is due to the datatype initialization fails before the datatype ID is registered. The datatype cleanup code should provide for the above situation. The code to fix the problem is the same as what is done in H5D__open_oid().
Diffstat (limited to 'src')
-rw-r--r--src/H5Dint.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 2539b2c..7580505 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1421,8 +1421,18 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info")
if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace")
- if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
+
+ if(new_dset->shared->type) {
+ if(new_dset->shared->type_id > 0) {
+ if(H5I_dec_ref(new_dset->shared->type_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
+ } /* end if */
+ else {
+ if(H5T_close_real(new_dset->shared->type) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
+ } /* end else */
+ } /* end if */
+
if(H5F_addr_defined(new_dset->oloc.addr)) {
if(H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")