Skip to content

Commit

Permalink
Correct H5VL_t ref count on H5O_refresh_metadata failure (HDFGroup#4636)
Browse files Browse the repository at this point in the history
* Fix bad H5VL_t rc on H5O_refresh_metadata fail

* Decrement nrefs before raising error
  • Loading branch information
mattjala authored and qkoziol committed Jul 16, 2024
1 parent 72a434d commit 016c233
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/H5Oflush.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,16 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
connector->nrefs++;

/* Close object & evict its metadata */
if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0)
if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0) {
connector->nrefs--;
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object");
}

/* Re-open the object, re-fetching its metadata */
if (H5O_refresh_metadata_reopen(oid, H5P_DEFAULT, &obj_loc, connector, false) < 0)
if (H5O_refresh_metadata_reopen(oid, H5P_DEFAULT, &obj_loc, connector, false) < 0) {
connector->nrefs--;
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object");
}

/* Restore the number of references on the VOL connector */
connector->nrefs--;
Expand Down

0 comments on commit 016c233

Please sign in to comment.