summaryrefslogtreecommitdiffstats
path: root/tools/src/h5ls/h5ls.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-04 21:45:40 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-04 21:45:40 (GMT)
commit46f8c941d7394d28befc660a7ab5532fa37a8e0f (patch)
tree046ff2e42299530fd844ac15c9ef49d19b85b25e /tools/src/h5ls/h5ls.c
parenta6d5bf1a86250cc660cd1ed420eeda6940792be5 (diff)
downloadhdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.zip
hdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.tar.gz
hdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.tar.bz2
HDFFV-10188 error on NULL dataspace
Diffstat (limited to 'tools/src/h5ls/h5ls.c')
-rw-r--r--tools/src/h5ls/h5ls.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 8c18794..a181186 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -1617,38 +1617,40 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
info = &outputformat;
- if(hexdump_g)
- p_type = H5Tcopy(type);
- else
- p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
-
- if(p_type >= 0) {
- /* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
-
- /* Check if we have VL data in the dataset's datatype */
- if (h5tools_detect_vlen(p_type) == TRUE)
- vl_data = TRUE;
-
- temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
- HDassert(temp_need == (hsize_t)((size_t)temp_need));
- need = (size_t)temp_need;
- buf = HDmalloc(need);
- HDassert(buf);
- if(H5Aread(attr, p_type, buf) >= 0) {
- ctx.need_prefix = TRUE;
- ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
- h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
- }
+ if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
+ if(hexdump_g)
+ p_type = H5Tcopy(type);
+ else
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+
+ if(p_type >= 0) {
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5tools_detect_vlen(p_type) == TRUE)
+ vl_data = TRUE;
+
+ temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
+ HDassert(temp_need == (hsize_t)((size_t)temp_need));
+ need = (size_t)temp_need;
+ buf = HDmalloc(need);
+ HDassert(buf);
+ if(H5Aread(attr, p_type, buf) >= 0) {
+ ctx.need_prefix = TRUE;
+ ctx.indent_level = 2;
+ ctx.cur_column = (size_t)curr_pos;
+ h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
+ }
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- HDfree(buf);
- H5Tclose(p_type);
- } /* end if */
+ HDfree(buf);
+ H5Tclose(p_type);
+ } /* end if */
+ }
H5Sclose(space);
H5Tclose(type);