summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-23 04:39:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-23 04:39:40 (GMT)
commitfcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0 (patch)
treea18fedef2b670c044913622650ef581dedce7ee1 /test
parent2c872f398b3824c416d42f2018c3d3ea0c40e80f (diff)
downloadhdf5-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 'test')
-rw-r--r--test/cache.c37
-rw-r--r--test/th5s.c10
2 files changed, 21 insertions, 26 deletions
diff --git a/test/cache.c b/test/cache.c
index eeb9038..734fc3b 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -14548,23 +14548,8 @@ check_rename_entry__run_test(H5C_t * cache_ptr,
test_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * test_ptr = NULL;
- if ( cache_ptr == NULL ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to rename test #%d.",
- test_num);
- failure_mssg = msg;
-
- } else if ( spec_ptr == NULL ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "spec_ptr NULL on entry to rename test #%d.",
- test_num);
- failure_mssg = msg;
-
- }
+ assert( cache_ptr );
+ assert( spec_ptr );
if ( pass ) {
@@ -14589,12 +14574,16 @@ check_rename_entry__run_test(H5C_t * cache_ptr,
}
}
- protect_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index);
+ if ( pass ) {
+
+ protect_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index);
- unprotect_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index,
- (int)(spec_ptr->is_dirty), flags);
+ unprotect_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index,
+ (int)(spec_ptr->is_dirty), flags);
- rename_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE);
+ rename_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE);
+
+ }
if ( pass ) {
@@ -17933,7 +17922,7 @@ check_check_evictions_enabled_err(void)
}
- if ( pass ) {
+ if ( cache_ptr ) {
takedown_cache(cache_ptr, FALSE, FALSE);
}
@@ -28232,7 +28221,7 @@ check_auto_cache_resize_input_errs(void)
}
}
- if ( pass ) {
+ if ( cache_ptr ) {
takedown_cache(cache_ptr, FALSE, FALSE);
}
@@ -28774,7 +28763,7 @@ check_auto_cache_resize_aux_fcns(void)
}
}
- if ( pass ) {
+ if ( cache_ptr ) {
takedown_cache(cache_ptr, FALSE, FALSE);
}
diff --git a/test/th5s.c b/test/th5s.c
index e21dee2..a38e384 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -699,11 +699,11 @@ test_h5s_scalar_write(void)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
+ hid_t sid1; /* Dataspace ID */
int rank; /* Logical rank of dataspace */
hsize_t tdims[4]; /* Dimension array to test with */
hssize_t n; /* Number of dataspace elements */
- H5S_class_t ext_type; /* Extent type */
+ H5S_class_t ext_type; /* Extent type */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -713,6 +713,12 @@ test_h5s_scalar_write(void)
fid1 = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fcreate");
+ /* Verify a non-zero rank fails with a NULL dimension. */
+ H5E_BEGIN_TRY {
+ sid1 = H5Screate_simple(SPACE1_RANK, NULL, NULL);
+ } H5E_END_TRY
+ VERIFY(sid1, FAIL, "H5Screate_simple");
+
/* Create scalar dataspace */
sid1 = H5Screate_simple(SPACE3_RANK, NULL, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");