diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-06-11 11:09:27 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-06-11 17:59:41 (GMT) |
commit | c4ee9ef7c05ce79e4503c1e5b3edfe8f912de60e (patch) | |
tree | fd0a24c6b63f7cc2ae8cd72675d062c540a3630c /src/H5Aint.c | |
parent | 48b0ff7724331737140ffae194cb2e741f0b668d (diff) | |
download | hdf5-c4ee9ef7c05ce79e4503c1e5b3edfe8f912de60e.zip hdf5-c4ee9ef7c05ce79e4503c1e5b3edfe8f912de60e.tar.gz hdf5-c4ee9ef7c05ce79e4503c1e5b3edfe8f912de60e.tar.bz2 |
Fixed a memory issue where unfreed shared attribute dataspace memory
tripped an assert in our memory sanity checks.
Fixes HDFFV-10774.
Diffstat (limited to 'src/H5Aint.c')
-rw-r--r-- | src/H5Aint.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c index 6162401..2240657 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1113,24 +1113,32 @@ H5A__free(H5A_t *attr) HDassert(attr); - /* Free dynamically allocated items */ + if(!attr->shared) + HGOTO_DONE(SUCCEED) + + /* Free dynamically allocated items. + * When possible, keep trying to shut things down (via HDONE_ERROR). + */ if(attr->shared->name) { H5MM_xfree(attr->shared->name); attr->shared->name = NULL; } if(attr->shared->dt) { if(H5T_close_real(attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") attr->shared->dt = NULL; } if(attr->shared->ds) { if(H5S_close(attr->shared->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") attr->shared->ds = NULL; } if(attr->shared->data) attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data); + /* Destroy shared attribute struct */ + attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__free() */ @@ -1199,9 +1207,6 @@ H5A__close(H5A_t *attr) /* Free dynamically allocated items */ if(H5A__free(attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") - - /* Destroy shared attribute struct */ - attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); } /* end if */ else { /* There are other references to the shared part of the attribute. |