diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-29 19:07:26 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-29 19:07:26 (GMT) |
commit | 7fe87a24722f991ffc030782cd42d24df00dbace (patch) | |
tree | 7d466f911a952916b99e2c86e83202d0e07cffaa /src/H5Ochunk.c | |
parent | 178b80b679b874d99287b28898e242533721ea67 (diff) | |
download | hdf5-7fe87a24722f991ffc030782cd42d24df00dbace.zip hdf5-7fe87a24722f991ffc030782cd42d24df00dbace.tar.gz hdf5-7fe87a24722f991ffc030782cd42d24df00dbace.tar.bz2 |
[svn-r19153] Description:
Bring changes on Coverity branch back to trunk:
r19040:
Fixed coverity #440 - NULL check after dereference. We moved the NULL check up
into the IF block and changed it to assertion.
r19041:
Maintenance: Addressed Coverity issues 441 and 449 by initializing proper
variables
r19042:
In function H5O_chunk_protect (H5Ochunk.c):
- Initialize H5O_chunk_proxy_t pointers chk_proxy and ret_value.
- Free chk_proxy on error.
r19043:
Addressed coverity issues 442 - 448 by initializing pointers to NULL.
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug & production
(Too minor to require h5committest)
Diffstat (limited to 'src/H5Ochunk.c')
-rw-r--r-- | src/H5Ochunk.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index f867d04..42b391d 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -148,8 +148,8 @@ done: H5O_chunk_proxy_t * H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) { - H5O_chunk_proxy_t *chk_proxy; /* Proxy for protected chunk */ - H5O_chunk_proxy_t *ret_value; /* Return value */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for protected chunk */ + H5O_chunk_proxy_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5O_chunk_protect, dxpl_id, oh->cache_info.addr, NULL) @@ -196,6 +196,11 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) ret_value = chk_proxy; done: + /* Cleanup on error */ + if(!ret_value) + if(0 == idx && chk_proxy) + chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy); + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_chunk_protect() */ |