diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-30 18:06:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-30 18:06:32 (GMT) |
commit | eff803f8249485e8b1fdb5c71197314f0527c995 (patch) | |
tree | 46163e26a5b0be38e839f8f195b1821ba25f86d6 /src/H5HFman.c | |
parent | 7fe87a24722f991ffc030782cd42d24df00dbace (diff) | |
download | hdf5-eff803f8249485e8b1fdb5c71197314f0527c995.zip hdf5-eff803f8249485e8b1fdb5c71197314f0527c995.tar.gz hdf5-eff803f8249485e8b1fdb5c71197314f0527c995.tar.bz2 |
[svn-r19156] Description:
Bring revisions from Coverity branch back to trunk:
r19044:
Coverity #449 - Line 1560 called function H5O_chunk_protect for 2 pointers to allocate. But when there's failure on the second one, the first wasn't freed
(H5O_chunk_unprotect). We fixed it by freeing the pointers when an error happens.
r19045:
Fixed coverity issue # 319. Free sec_node in done if it is not NULL.
r19046:
Add intended but missing assignments to initialize pointers to NULL (coverity issue fixes).
r19049:
Hdf5_1_8_coverity branch was recreated from hdf5_1_8 branch in revision 18839 without fix for Coverity issue #84 having been propagated to the hdf5_1_8 branch. This revision adds the fix again.
r19060:
added parentheses to see if they will keep subversion from getting confused
r19061:
Fix coverity item 139. Fixed incorrect condition for freeing buffer on error.
Fix coverity items 20 and 21. Removed unused NTESTS facility from dtypes.c.
Cleanup in H5Shyper.c.
r19062:
Fix coverity item 450. Check to see if chk_proxy has been allocated before
attempting to free it.
Fix coverity item 454. Check to see if allocation of buf failed in
H5D_fill_refill_vl.
Fix coverity items 455-457. Initilize hid_t's to -1, check their value before
attempting to close them, and check if the close failed.
r19063:
New fix to address coverity issue #84. Check that pointers in H5Z_xform_find_type are not NULL before passing them to H5T_cmp.
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug & production
(Too minor to require h5committest)
Diffstat (limited to 'src/H5HFman.c')
-rw-r--r-- | src/H5HFman.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/H5HFman.c b/src/H5HFman.c index 0ec6f5f..b1fb322 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -107,7 +107,7 @@ herr_t H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj, void *_id) { - H5HF_free_section_t *sec_node; /* Pointer to free space section */ + H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section */ H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */ haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */ size_t dblock_size; /* Direct block size */ @@ -176,6 +176,7 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj /* Reduce (& possibly re-add) single section */ if(H5HF_sect_single_reduce(hdr, dxpl_id, sec_node, obj_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node") + sec_node = NULL; /* Encode the object in the block */ { @@ -203,6 +204,11 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") done: + /* Release section node on error */ + if(ret_value < 0) + if(sec_node && H5HF_sect_single_free((H5FS_section_info_t *)sec_node) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node") + /* Release the direct block (marked as dirty) */ if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") @@ -332,7 +338,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, blk_off = (size_t)(obj_off - dblock->block_off); /* Check for object's offset in the direct block prefix information */ - if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) + if(blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block") /* Check for object's length overrunning the end of the direct block */ @@ -553,7 +559,7 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) blk_off = (size_t)(obj_off - dblock_block_off); /* Check for object's offset in the direct block prefix information */ - if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) + if(blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block") /* Check for object's length overrunning the end of the direct block */ |