mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
Make H5T__free more aggressive about cleanup (#5054)
oss-fuzz often trips over unfreed datatype memory when parsing fuzzed files. This changes H5T__free() to use HDONE macros so cleanup continues on errors.
This commit is contained in:
parent
92033dff84
commit
e8257bd2b5
@ -4133,7 +4133,8 @@ H5T__free(H5T_t *dt)
|
||||
for (i = 0; i < dt->shared->u.compnd.nmembs; i++) {
|
||||
dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name);
|
||||
if (H5T_close_real(dt->shared->u.compnd.memb[i].type) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL,
|
||||
/* Push errors, but keep going */
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL,
|
||||
"unable to close datatype for compound member");
|
||||
}
|
||||
dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb);
|
||||
@ -4170,12 +4171,14 @@ H5T__free(H5T_t *dt)
|
||||
/* Close the parent */
|
||||
assert(dt->shared->parent != dt);
|
||||
if (dt->shared->parent && H5T_close_real(dt->shared->parent) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type");
|
||||
/* Push errors, but keep going */
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type");
|
||||
dt->shared->parent = NULL;
|
||||
|
||||
/* Close the owned VOL object */
|
||||
if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object");
|
||||
/* Push errors, but keep going */
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object");
|
||||
dt->shared->owned_vol_obj = NULL;
|
||||
|
||||
done:
|
||||
|
Loading…
Reference in New Issue
Block a user