diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-04-14 17:32:13 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-04-14 17:32:13 (GMT) |
commit | 95453166e60ab6ddc3ee8b8719e1868afa589cbf (patch) | |
tree | fcef73116df6c01e9b937aa677f29326e09973ab /src | |
parent | 0dba296cec0d3e9391e1cbb0f6daa0df9f0a750a (diff) | |
parent | 32fcd8f7721ae218a86bf2438f1868c85a2c2fe9 (diff) | |
download | hdf5-95453166e60ab6ddc3ee8b8719e1868afa589cbf.zip hdf5-95453166e60ab6ddc3ee8b8719e1868afa589cbf.tar.gz hdf5-95453166e60ab6ddc3ee8b8719e1868afa589cbf.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/hdf5_1_8)
* commit '32fcd8f7721ae218a86bf2438f1868c85a2c2fe9':
A fix in the cleaning up code for datatype when datatype initialization via H5D__init_type() fails. 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.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index b3c2d29..730a71f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1185,7 +1185,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, ret_value = new_dset; done: - if(!ret_value && new_dset && new_dset->shared) { + if(!ret_value && new_dset) { if(new_dset->shared) { if(new_dset->shared->layout.type == H5D_CHUNKED && layout_init) { if(H5D__chunk_dest(file, dxpl_id, new_dset) < 0) @@ -1193,8 +1193,16 @@ done: } /* end if */ 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, NULL, "unable to release datatype") + } /* end if */ + else { + if(H5T_close(new_dset->shared->type) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "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), dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") |