summaryrefslogtreecommitdiffstats
path: root/src/H5Rint.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2020-03-13 16:22:22 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2020-03-13 16:22:22 (GMT)
commit81b1ed4e1724b8a6a731ab2b8fb03234a8b49d15 (patch)
tree038db381bcae2713b24a7f1f50e73d54faad354d /src/H5Rint.c
parenta24b0c4a848c08454831ad9c561e234c1248a821 (diff)
downloadhdf5-81b1ed4e1724b8a6a731ab2b8fb03234a8b49d15.zip
hdf5-81b1ed4e1724b8a6a731ab2b8fb03234a8b49d15.tar.gz
hdf5-81b1ed4e1724b8a6a731ab2b8fb03234a8b49d15.tar.bz2
Fix issues when deserializing point/all/none selection with version beyond the library's supported version:
(1) Verify the decoded version before proceeding further with deserialization (2) Close the dataspace if errors occurred after opening the dataspace
Diffstat (limited to 'src/H5Rint.c')
-rw-r--r--src/H5Rint.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 1df8a20..30f3dbb 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -1768,6 +1768,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
H5O_token_t token = { 0 };
size_t data_size;
const uint8_t *p;
+ H5S_t *space = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -1788,7 +1789,6 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
if(space_ptr) {
H5O_loc_t oloc; /* Object location */
- H5S_t *space = NULL;
/* Initialize the object location */
H5O_loc_reset(&oloc);
@@ -1812,6 +1812,12 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
done:
H5MM_free(data);
+
+ if(ret_value < 0) {
+ if(space && H5S_close(space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ }
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_token_region_compat() */