summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlrknox <lrknox>2017-10-23 03:35:15 (GMT)
committerlrknox <lrknox>2017-10-23 03:35:15 (GMT)
commite92f3f858bf16a84c59aeb6692f5cab5e6b8e66f (patch)
tree2736dfef9abde14a922a5f150e17004152a70384
parentd5acbfeb9e469ada610c4efa35a225be1cc2e0c1 (diff)
downloadhdf5-e92f3f858bf16a84c59aeb6692f5cab5e6b8e66f.zip
hdf5-e92f3f858bf16a84c59aeb6692f5cab5e6b8e66f.tar.gz
hdf5-e92f3f858bf16a84c59aeb6692f5cab5e6b8e66f.tar.bz2
Fix for HDFFFV-10308. Initialize hid_ts in function check_objects and
check for id > -1 before calling close functions.
-rw-r--r--tools/src/h5repack/h5repack.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 14b9461..22ca279 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -707,9 +707,9 @@ done:
*/
static int check_objects(const char* fname, pack_opt_t *options) {
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t fid;
- hid_t did;
- hid_t sid;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
unsigned int i;
unsigned int uf;
trav_table_t *travt = NULL;
@@ -810,9 +810,12 @@ static int check_objects(const char* fname, pack_opt_t *options) {
done:
H5E_BEGIN_TRY {
- H5Sclose(sid);
- H5Dclose(did);
- H5Fclose(fid);
+ if (sid > -1)
+ H5Sclose(sid);
+ if (did > -1)
+ H5Dclose(did);
+ if (fid > -1)
+ H5Fclose(fid);
} H5E_END_TRY;
if (travt)
trav_table_free(travt);