diff options
Diffstat (limited to 'src/H5HG.c')
-rw-r--r-- | src/H5HG.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -786,6 +786,7 @@ H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) } } } + heap=NULL; done: FUNC_LEAVE_NOAPI(ret_value); @@ -853,6 +854,7 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/) } } } + heap = NULL; /* Set return value */ ret_value=object; @@ -943,6 +945,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) size_t need; int i; unsigned u; + hbool_t deleted=FALSE; /* Whether the heap gets deleted */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HG_remove, FAIL); @@ -995,11 +998,11 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) heap->cache_info.dirty = FALSE; H5_CHECK_OVERFLOW(heap->size,size_t,hsize_t); H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, heap->addr, (hsize_t)heap->size); - H5AC_flush (f, dxpl_id, H5AC_GHEAP, heap->addr, H5F_FLUSH_INVALIDATE); + deleted=TRUE; /* Indicate that the object was deleted, for the unprotect call */ } else { /* * If the heap is in the CWFS list then advance it one position. The - * H5AC_find() might have done that too, but that's okay. If the + * H5AC_protect() might have done that too, but that's okay. If the * heap isn't on the CWFS list then add it to the end. */ for (i=0; i<f->shared->ncwfs; i++) { @@ -1017,9 +1020,9 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) } } - if (H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, FALSE) != SUCCEED) +done: + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, deleted) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); -done: FUNC_LEAVE_NOAPI(ret_value); } |