diff options
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() */ |