diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-02-09 22:39:43 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-02-09 22:39:43 (GMT) |
commit | c5c85080a7d1dcae35cffba922d88320a2475ec8 (patch) | |
tree | 64fe3bdcbe1216f26757a50c1811657a2fd05f0f /test/cache_common.c | |
parent | cc1c7331a5f57b1d8beae65c257164e11060ebef (diff) | |
download | hdf5-c5c85080a7d1dcae35cffba922d88320a2475ec8.zip hdf5-c5c85080a7d1dcae35cffba922d88320a2475ec8.tar.gz hdf5-c5c85080a7d1dcae35cffba922d88320a2475ec8.tar.bz2 |
[svn-r18225] Description:
Bring r18244 from trunk to 1.8 branch:
Bring revisions from Coverity session from hdf5_1_8_coverity branch to
trunk:
r18214:
Issue 423: cache_ptr was not initialized. if global 'pass' was false,
cache_ptr could be used. Extended scope of if(pass) block to include whole
function-flush_cache().
r18215:
Fix coverity item 317. Removed unreachable code in H5B2_hdr_alloc.
r18216:
Fixed Coverity issues 57 & 67. Checked oid_count > 0 before memory allocation
and oid_list != NULL before dereferencing.
Tested on:
Mac OS X/32 10.6.2 (amazon) w/debug & production
(daily tested on Coverity branch already)
Diffstat (limited to 'test/cache_common.c')
-rw-r--r-- | test/cache_common.c | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/test/cache_common.c b/test/cache_common.c index eb40a0e..9e27c80 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2712,61 +2712,59 @@ flush_cache(H5F_t * file_ptr, hbool_t dump_detailed_stats) { const char * fcn_name = "flush_cache()"; - H5C_t * cache_ptr; - herr_t result = 0; hbool_t verbose = FALSE; verify_unprotected(); - if ( pass ) { + if(pass) { + H5C_t * cache_ptr = NULL; + herr_t result = 0; HDassert(file_ptr); cache_ptr = file_ptr->shared->cache; - if ( destroy_entries ) { + if(destroy_entries) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, - H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); - } else { - - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, - H5C__NO_FLAGS_SET); } - } + else { - if ( dump_stats ) { + result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + } - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - } + if(dump_stats) { - if ( result < 0 ) { + H5C_stats(cache_ptr, "test cache", dump_detailed_stats); + } - pass = FALSE; - failure_mssg = "error in H5C_flush_cache()."; - } - else if ( ( destroy_entries ) && - ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) || - ( cache_ptr->clean_index_size != 0 ) || - ( cache_ptr->dirty_index_size != 0 ) ) ) { + if(result < 0) { - if ( verbose ) { - HDfprintf(stdout, - "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", - fcn_name, - (long long)(cache_ptr->index_len), - (long long)(cache_ptr->index_size), - (long long)(cache_ptr->clean_index_size), - (long long)(cache_ptr->dirty_index_size)); - } - pass = FALSE; - failure_mssg = - "non zero index len/sizes after H5C_flush_cache() with invalidate."; + pass = FALSE; + failure_mssg = "error in H5C_flush_cache()."; + } + else if((destroy_entries) && ((cache_ptr->index_len != 0) + || (cache_ptr->index_size != 0) + || (cache_ptr->clean_index_size != 0) + || (cache_ptr->dirty_index_size != 0))) { + + if(verbose) { + HDfprintf(stdout, + "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", + fcn_name, + (long long)(cache_ptr->index_len), + (long long)(cache_ptr->index_size), + (long long)(cache_ptr->clean_index_size), + (long long)(cache_ptr->dirty_index_size)); + } + pass = FALSE; + failure_mssg = "non zero index len/sizes after H5C_flush_cache() with invalidate."; + } } - return; } /* flush_cache() */ |