diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-23 04:53:22 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-23 04:53:22 (GMT) |
commit | ab37aae39f7754827774577a0053e1b0979b3b1d (patch) | |
tree | f5b018adbd378048d6a8112ab94f873eeb5dddb1 /fortran/test | |
parent | e8538794ef18febaa471a2a81639c9a9ef7bfba1 (diff) | |
download | hdf5-ab37aae39f7754827774577a0053e1b0979b3b1d.zip hdf5-ab37aae39f7754827774577a0053e1b0979b3b1d.tar.gz hdf5-ab37aae39f7754827774577a0053e1b0979b3b1d.tar.bz2 |
[svn-r18158] Description:
Bring r18157 from trunk to 1.8 branch:
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')
-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; } |