Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix objects not being closed on objcopy test failure #5331

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/objcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
H5G_info_t ginfo2; /* Group info struct */
hsize_t idx; /* Index over the objects in group */
unsigned cpy_flags; /* Object copy flags */
hid_t oid = H5I_INVALID_HID; /* IDs of objects within group */
hid_t oid2 = H5I_INVALID_HID;

/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
if (pid != H5P_DEFAULT) {
Expand Down Expand Up @@ -1564,7 +1566,6 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)

/* Extra checks for "real" objects */
if (linfo.type == H5L_TYPE_HARD) {
hid_t oid, oid2; /* IDs of objects within group */
H5O_info2_t oinfo, oinfo2; /* Data model object info */
H5O_native_info_t ninfo, ninfo2; /* Native file format object info */

Expand Down Expand Up @@ -1649,8 +1650,11 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
/* Close objects */
if (H5Oclose(oid) < 0)
TEST_ERROR;
oid = H5I_INVALID_HID;

if (H5Oclose(oid2) < 0)
TEST_ERROR;
oid2 = H5I_INVALID_HID;
} /* end if */
else {
/* Check that both links are the same size */
Expand Down Expand Up @@ -1691,6 +1695,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
error:
H5E_BEGIN_TRY
{
H5Oclose(oid);
H5Oclose(oid2);
}
H5E_END_TRY
return false;
Expand Down
Loading