summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-10-06 05:16:51 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-10-06 05:16:51 (GMT)
commit75b84b09bd249b36a063fd51ecd3383801b0118b (patch)
tree06eec7c56a35417e4613e5a2b0bf3dfaf6c3de5a
parent1b2c820b4bdb0a176cba20ccdb87b07f7ab5eede (diff)
downloadhdf5-75b84b09bd249b36a063fd51ecd3383801b0118b.zip
hdf5-75b84b09bd249b36a063fd51ecd3383801b0118b.tar.gz
hdf5-75b84b09bd249b36a063fd51ecd3383801b0118b.tar.bz2
Updated the H5I debug dump to not segfault when types are not initialized
or contain zero IDs in the skip list.
-rw-r--r--src/H5I.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/H5I.c b/src/H5I.c
index 61b2783..34874c7 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2188,15 +2188,22 @@ H5I_dump_ids_for_type(H5I_type_t type)
HDfprintf(stderr, "Dumping ID type %d\n", (int)type);
type_ptr = H5I_id_type_list_g[type];
- /* Header */
- HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count);
- HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
- HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count);
- HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid);
-
- /* List */
- HDfprintf(stderr, " List:\n");
- H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type);
+ if(type_ptr) {
+
+ /* Header */
+ HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count);
+ HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
+ HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count);
+ HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid);
+
+ /* List */
+ if(type_ptr->id_count > 0) {
+ HDfprintf(stderr, " List:\n");
+ H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type);
+ }
+ }
+ else
+ HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5I_dump_ids_for_type() */