diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2019-01-08 02:36:34 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2019-01-08 02:36:34 (GMT) |
commit | 78d0564c2afa2241899a2bd43aa1bd6af7a3fda2 (patch) | |
tree | 4d29600f200a69e86e2f29a23663b3fdf254cf73 /tools | |
parent | 6c7462b1a913e4b7fb4fb76c4a3097a83a517720 (diff) | |
download | hdf5-78d0564c2afa2241899a2bd43aa1bd6af7a3fda2.zip hdf5-78d0564c2afa2241899a2bd43aa1bd6af7a3fda2.tar.gz hdf5-78d0564c2afa2241899a2bd43aa1bd6af7a3fda2.tar.bz2 |
Refixed HDFFV-10578
Description:
Applied Neil's fix for this issue after removing previous
attempt. The resources are now released in init_objs() when
failure occurs there.
Neil will fix HDFFV-10676 separately.
Platforms tested:
Linux/64 (jelly)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5tools_utils.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 8ac0d32..b33ba13 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -561,6 +561,8 @@ herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table) { + herr_t ret_value = SUCCEED; + /* Initialize the tables */ init_table(group_table); init_table(dset_table); @@ -573,7 +575,20 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, info->dset_table = *dset_table; /* Find all shared objects */ - return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)); + if((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "finding shared objects failed") + +done: + /* Release resources */ + if(ret_value == FAIL) { + free_table(*group_table); + info->group_table = NULL; + free_table(*type_table); + info->type_table = NULL; + free_table(*dset_table); + info->dset_table = NULL; + } + return ret_value; } |