summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump
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/h5dump
parenta6d5bf1a86250cc660cd1ed420eeda6940792be5 (diff)
downloadhdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.zip
hdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.tar.gz
hdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.tar.bz2
HDFFV-10188 error on NULL dataspace
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r--tools/src/h5dump/h5dump_xml.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 49d4f96..d731013 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -1959,28 +1959,32 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
H5Tclose(type);
space = H5Aget_space(obj_id);
+ if(space == H5S_NULL || space == H5S_NO_CLASS) {
+ status = SUCCEED;
+ }
+ else {
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ for (i = 0; i < ndims; i++)
+ nelmts *= size[i];
- for (i = 0; i < ndims; i++)
- nelmts *= size[i];
+ buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
+ HDassert(buf);
- buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
- HDassert(buf);
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
+ h5tools_context_t datactx;
+ HDmemset(&datactx, 0, sizeof(datactx));
+ datactx.need_prefix = TRUE;
+ datactx.indent_level = ctx.indent_level;
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ }
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- if (H5Aread(obj_id, p_type, buf) >= 0) {
- h5tools_context_t datactx;
- HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
- datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ HDfree(buf);
}
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
-
- HDfree(buf);
H5Tclose(p_type);
H5Sclose(space);
H5Tclose(type);