diff options
Diffstat (limited to 'tools/lib/h5tools.c')
-rw-r--r-- | tools/lib/h5tools.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 274b398..19d71bb 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1641,8 +1641,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, hsize_t alloc_size; hsize_t *ptdata; int ndims; - hid_t dtype; - hid_t type_id; + hid_t dtype = -1; + hid_t type_id = -1; if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); @@ -1672,10 +1672,10 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, done: HDfree(ptdata); - if(H5Tclose(type_id) < 0) + if(type_id > 0 && H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Tclose(dtype) < 0) + if(dtype > 0 && H5Tclose(dtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); H5_LEAVE(TRUE) @@ -1765,8 +1765,8 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, HERR_INIT(hbool_t, TRUE) hssize_t npoints; int ndims; - hid_t dtype; - hid_t type_id; + hid_t dtype = -1; + hid_t type_id = -1; if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); @@ -1785,10 +1785,10 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, stream, container, ndims, type_id, npoints); done: - if(H5Tclose(type_id) < 0) + if(type_id > 0 && H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Tclose(dtype) < 0) + if(dtype > 0 && H5Tclose(dtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); H5_LEAVE(ret_value) |