summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5trav.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5trav.c')
-rw-r--r--tools/lib/h5trav.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 0ed6a30..bb8014d 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -159,8 +159,11 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
H5O_info_t oinfo;
/* Get information about the object */
- if(H5Oget_info_by_name(loc_id, path, &oinfo, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name(loc_id, path, &oinfo, H5P_DEFAULT) < 0) {
+ if(new_name)
+ HDfree(new_name);
return(H5_ITER_ERROR);
+ }
/* If the object has multiple links, add it to the list of addresses
* already visited, if it isn't there already
@@ -171,12 +174,20 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
/* Make 'visit object' callback */
if(udata->visitor->visit_obj)
- (*udata->visitor->visit_obj)(full_name, &oinfo, already_visited, udata->visitor->udata);
+ if((*udata->visitor->visit_obj)(full_name, &oinfo, already_visited, udata->visitor->udata) < 0) {
+ if(new_name)
+ HDfree(new_name);
+ return(H5_ITER_ERROR);
+ }
} /* end if */
else {
/* Make 'visit link' callback */
if(udata->visitor->visit_lnk)
- (*udata->visitor->visit_lnk)(full_name, linfo, udata->visitor->udata);
+ if((*udata->visitor->visit_lnk)(full_name, linfo, udata->visitor->udata) < 0) {
+ if(new_name)
+ HDfree(new_name);
+ return(H5_ITER_ERROR);
+ }
} /* end else */
if(new_name)