diff options
Diffstat (limited to 'src/H5Ochunk.c')
-rw-r--r-- | src/H5Ochunk.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 79c4442..42b391d 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -118,7 +118,7 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header") /* Insert the chunk proxy into the cache */ - if(H5AC_set(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk") chk_proxy = NULL; @@ -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() */ |