summaryrefslogtreecommitdiffstats
path: root/src/H5Oname.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2013-02-27 19:22:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2013-02-27 19:22:27 (GMT)
commitb2f2370b1f26b8864c70f7ccc8cc023260ca99a0 (patch)
treef9bc7e59d6e48d5de16c21f48b214489d58725b3 /src/H5Oname.c
parente8fa6193f5ae4713f2ca9ff02965951c9d97016b (diff)
downloadhdf5-b2f2370b1f26b8864c70f7ccc8cc023260ca99a0.zip
hdf5-b2f2370b1f26b8864c70f7ccc8cc023260ca99a0.tar.gz
hdf5-b2f2370b1f26b8864c70f7ccc8cc023260ca99a0.tar.bz2
[svn-r23321] Description:
Merge r23313 from trunk to 1.8 branch: Bring changes from Coverity branch to the trunk: r20612: Changed string functions to versions with string length to fix coverity issues 922, 942 and 943. r20614: Use HDsnprintf. --gh r20675: Fix for coverity #1714 due to the fix for #810. Use HDfree() instead of H5MM_xfree(). r20678: Repaired coverity issue #598 -- failure to check return value from a call to fstat(), or to tidy up in the event of failure. r20679: Use HDstrncpy. --gh r20681: Use HDstrncat and HDstrncpy. --gh Tested on: Mac OSX/64 10.8.2 (amazon) w/debug, C++ & FORTRAN (too minor to require h5committest)
Diffstat (limited to 'src/H5Oname.c')
-rw-r--r--src/H5Oname.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/H5Oname.c b/src/H5Oname.c
index fb44000..c1cb8c8 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -97,10 +97,10 @@ H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
HDassert(p);
/* decode */
- if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t))) ||
- NULL == (mesg->s = (char *)H5MM_malloc(HDstrlen((const char *)p) + 1)))
+ if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (mesg->s = (char *)H5MM_strdup((const char *)p)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDstrcpy(mesg->s, (const char *)p);
/* Set return value */
ret_value = mesg;
@@ -138,9 +138,9 @@ H5O_name_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, cons
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(f);
- assert(p);
- assert(mesg && mesg->s);
+ HDassert(f);
+ HDassert(p);
+ HDassert(mesg && mesg->s);
/* encode */
HDstrcpy((char*)p, mesg->s);