summaryrefslogtreecommitdiffstats
path: root/src/H5Tenum.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-05 02:56:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-05 02:56:25 (GMT)
commitc462a2ec1f5af1f57935be0caa1209f0ae9d63c4 (patch)
treec97f69dfe164146a66a796ed5eec3e41dfec1ae8 /src/H5Tenum.c
parent9cd44ec31a6d948d03366a3db06830d240e188e9 (diff)
downloadhdf5-c462a2ec1f5af1f57935be0caa1209f0ae9d63c4.zip
hdf5-c462a2ec1f5af1f57935be0caa1209f0ae9d63c4.tar.gz
hdf5-c462a2ec1f5af1f57935be0caa1209f0ae9d63c4.tar.bz2
[svn-r18212] Description:
Bring revisions from Coverity fixing branch to trunk: r18184: Fixed Coverity issue 373. Allocated memory freed in line 762 in case of error. r18185: Fixed Coverity issues 357 & 358. Added check for NULL pointer before use. r18186: Fix coverity item 65. Added code to h5unjam to correctly handle failures in read() and write, and also to correctly handle writes that write less than requested. r18187: Fix coverity items 115 and 116. Added code to H5Tenum.c to correctly close opened datatypes in case of failure. r18188: Fixed Coverity issue 46. Check that dataset->shared is not null when freeing memory after error. r18190: Fix coverity item 95. Added code to H5T_create_vlen to correctly close allocated datatype in case of failure. r18191: Fixed Coverity error 59. Checked sfirst for -1 value before use in line 10533. r18192: Fix Coverity items 121 and 28 Added Asserts: 121: assert that all dimensions of count have values greater than zero. 28: assert curr_span pointer is not null before dereference. Note: still need too add checks in hyperslab APIs that fail when count values are zero, and appropriate tests. r18194: Fixed Coverity issues 61 & 62. Checked variable snpoints for value < 0 in line 218. Tested on: Mac OS X/32 10.6.2 (amazon) w/debug & production (already daily tested on coverity branch)
Diffstat (limited to 'src/H5Tenum.c')
-rw-r--r--src/H5Tenum.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index f955a7e..6da6931 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -466,10 +466,11 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si
/* Set return value */
ret_value=name;
- if (H5T_close(copied_dt)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close data type");
-
done:
+ if(copied_dt)
+ if(H5T_close(copied_dt) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close data type");
+
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -591,9 +592,11 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/)
HDmemcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size);
- if (H5T_close(copied_dt)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close data type");
-
done:
+ if(copied_dt)
+ if(H5T_close(copied_dt) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close data type")
+
FUNC_LEAVE_NOAPI(ret_value)
}
+