summaryrefslogtreecommitdiffstats
path: root/src/H5HFiter.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-20 02:23:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-20 02:23:44 (GMT)
commit0c39a78927ae1e4b7471f96743a8cf5dd30350b0 (patch)
tree21eb68c066d6ef8a139278439d02c89202ce970f /src/H5HFiter.c
parent7bac0bb48dd18809fa015e91848dc8756c0fe536 (diff)
downloadhdf5-0c39a78927ae1e4b7471f96743a8cf5dd30350b0.zip
hdf5-0c39a78927ae1e4b7471f96743a8cf5dd30350b0.tar.gz
hdf5-0c39a78927ae1e4b7471f96743a8cf5dd30350b0.tar.bz2
[svn-r18300] Description:
Bring Coverity fixes from branch to trunk: r18282: Fix Coverity issue #428 by wrapping testing calls with if(pass) {} block. r18283: Fix Coverity issue #425 by wrapping test calls in if(pass) {} block r18284: Issue 166: init_error() malloc'd 3 pointers in initialization and never freed inc ase of errors. Init pointers to NULL, check allocation results and free allocations in error block r18285: Fix Coverity issue #410 by wrapping test calls with if(pass) {} block. r18286: Issue 165: custom_print_cb() needed allocations freed in error block. r18287: Fix coverity issue # 409 Added if (pass) checks around calls to flush_cache. Additionally, added a check for file_ptr = NULL after call to setup_cache. r18288: Fix coverity# 107 free fh in H5HF_close() correctly before exit the function even when failure occurs. r18289: Fix Coverity issue #429: correct failure return values to match return type from routine. r18290: Fix Coverity issue #103: release allocated indirect section on error r18294: Issue 153, 152: Check allocations and free allocations in error block. Also cleaned up hid_t identifer that were opened in error block. r18295: Fix coverity# 101 free new_loc in H5HF_man_iter_start_entry() correctly before exit the function even when failure occurs r18296: Fix coverity# 100 free down_loc in H5HF_man_iter_down() before exit the function when failure occurs r18297: Fixed coverity issues 54, 55 and 216. Correctly handle the various ways that allocation of attr_name can fail in test_attr_basic_write. r18298: Fix coverity# 119 free object in H5HG_read() before exit the function when failure occurs r18299: Fix coverity issue #112: Add cleanup during error handling of H5MP_create. Tested on: Mac OS X/32 10.6.2 (amazon) w/debug & production Misc. Linux configurations (on original checkins)
Diffstat (limited to 'src/H5HFiter.c')
-rw-r--r--src/H5HFiter.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/H5HFiter.c b/src/H5HFiter.c
index a3c61d7..f7178a1 100644
--- a/src/H5HFiter.c
+++ b/src/H5HFiter.c
@@ -315,7 +315,7 @@ herr_t
H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
H5HF_indirect_t *iblock, unsigned start_entry)
{
- H5HF_block_loc_t *new_loc; /* Pointer to new block location */
+ H5HF_block_loc_t *new_loc = NULL; /* Pointer to new block location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_start_entry)
@@ -350,6 +350,9 @@ H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
biter->ready = TRUE;
done:
+ if(ret_value < 0 && new_loc)
+ new_loc = H5FL_FREE(H5HF_block_loc_t, new_loc);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_start_entry() */
@@ -397,7 +400,7 @@ H5HF_man_iter_reset(H5HF_block_iter_t *biter)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
/* Free the current location context */
- (void)H5FL_FREE(H5HF_block_loc_t, curr_loc);
+ curr_loc = H5FL_FREE(H5HF_block_loc_t, curr_loc);
/* Advance to next location */
curr_loc = next_loc;
@@ -489,7 +492,7 @@ H5HF_man_iter_up(H5HF_block_iter_t *biter)
up_loc = biter->curr->up;
/* Release this location */
- (void)H5FL_FREE(H5HF_block_loc_t, biter->curr);
+ biter->curr = H5FL_FREE(H5HF_block_loc_t, biter->curr);
/* Point location to next location up */
biter->curr = up_loc;
@@ -515,7 +518,7 @@ done:
herr_t
H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock)
{
- H5HF_block_loc_t *down_loc; /* Pointer to new 'down' block location */
+ H5HF_block_loc_t *down_loc = NULL; /* Pointer to new 'down' block location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_down)
@@ -547,6 +550,9 @@ H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock)
biter->curr = down_loc;
done:
+ if(ret_value < 0 && down_loc)
+ down_loc = H5FL_FREE(H5HF_block_loc_t, down_loc);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_down() */