diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-23 04:39:40 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-23 04:39:40 (GMT) |
commit | fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0 (patch) | |
tree | a18fedef2b670c044913622650ef581dedce7ee1 /fortran/test/t.c | |
parent | 2c872f398b3824c416d42f2018c3d3ea0c40e80f (diff) | |
download | hdf5-fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0.zip hdf5-fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0.tar.gz hdf5-fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0.tar.bz2 |
[svn-r18157] Description:
Bring back changes from Coverity session on 1/15/10:
r18111:
Fix Coverity issue #130: make certain that the cache gets freed on error.
r18112:
Fix Coverity issue #43 by making cache testing calls protected by 'pass'
variable.
r18113:
Fix Coverity issue #129 by releasing the cache on error.
r18115:
Coverity #45 fix: patched an error check in H5Screate_simple to prevent future dereferencing of a NULL point.
Added a verification in test/th5s.c.
r18116:
Fix Coverity issue #43 by releasing cache on error.
r18117:
Coverity #362,363 by adding HGOTO_DONE, freeing allocations and associated changes. REsolving coverity results #364-368, 369, 370-372, 377, 379, and 380.
r18118:
Fix Coverity issue #42: assert that cache & test specification pointer are
valid.
r18122:
Coverity #362,363 by adding HGOTO_DONE and freeing allocations. This also takes care of #357,358.
r18123:
Coverity #359-361, 373-376: Added HGOTO_DONE(FAIL) statement after checking allocation for NULL. Verified allocation is freed in done block.
r18128:
Fixed coverity issue #10 -- removed dead code.
Tested on:
Mac OS X/32 10.6.2 (amazon)
Diffstat (limited to 'fortran/test/t.c')
-rw-r--r-- | fortran/test/t.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/fortran/test/t.c b/fortran/test/t.c index 861a3e7..f2203d0 100644 --- a/fortran/test/t.c +++ b/fortran/test/t.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "t.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5_fixname_c @@ -31,35 +32,31 @@ int_f nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl, _fcd full_name, size_t_f *full_namelen) { - int ret_value = -1; - char *c_base_name; - char *c_full_name; - hid_t c_fapl; + char *c_base_name = NULL; + char *c_full_name = NULL; + int_f ret_value = 0; /* - * Define ifile access property list - */ - c_fapl = (hid_t)*fapl; - /* * Convert FORTRAN name to C name */ - c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen); - if (c_base_name == NULL) goto DONE; - c_full_name = (char *) HDmalloc((size_t)*full_namelen + 1); - if (c_full_name == NULL) goto DONE; + if(NULL == (c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_full_name = (char *)HDmalloc((size_t)*full_namelen + 1))) + HGOTO_DONE(FAIL) /* * Call h5_fixname function. */ - if (NULL != h5_fixname(c_base_name, c_fapl, c_full_name, (size_t)*full_namelen + 1)) { - HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen); - ret_value = 0; - goto DONE; - } + if(NULL == h5_fixname(c_base_name, (hid_t)*fapl, c_full_name, (size_t)*full_namelen + 1)) + HGOTO_DONE(FAIL) + HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen); + +done: + if(c_base_name) + HDfree(c_base_name); + if(c_full_name) + HDfree(c_full_name); -DONE: - if (NULL != c_base_name) HDfree(c_base_name); - if (NULL != c_full_name) HDfree(c_full_name); return ret_value; } |