summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorvchoi <vchoi@jelly.ad.hdfgroup.org>2020-03-23 06:16:32 (GMT)
committervchoi <vchoi@jelly.ad.hdfgroup.org>2020-03-23 06:16:32 (GMT)
commitafdcac28b85d690eebc80ab568fa5266081baaaa (patch)
tree6d5a2bff45d9294646eb3367a882f3b73ef96082 /src
parent26fecb8c5a444c64106c36750addfc9d71338c1d (diff)
downloadhdf5-afdcac28b85d690eebc80ab568fa5266081baaaa.zip
hdf5-afdcac28b85d690eebc80ab568fa5266081baaaa.tar.gz
hdf5-afdcac28b85d690eebc80ab568fa5266081baaaa.tar.bz2
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 1624f7b..173ae3f 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1418,8 +1418,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")