From 77dedb3c64efeb1636696f6ab19163f66986aac4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 1 Mar 2013 15:09:40 -0500 Subject: [svn-r23322] HDFFV-8322: Close resources, found from valgrind testing Tested: local linux --- test/CMakeLists.txt | 3 +++ test/tfile.c | 11 ++++++++++- test/th5o.c | 4 ++++ test/th5s.c | 11 +++++------ test/tsohm.c | 8 ++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index aa92371..b830bc4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -225,6 +225,9 @@ ADD_TEST ( ) ADD_TEST (NAME testhdf5 COMMAND $) SET_TESTS_PROPERTIES(testhdf5 PROPERTIES DEPENDS h5test-clear-testhdf5-objects) +IF (HDF5_ENABLE_USING_MEMCHECKER) + SET_TESTS_PROPERTIES(testhdf5 PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) +ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ############################################################################## ############################################################################## diff --git a/test/tfile.c b/test/tfile.c index 8ee0b64..e669bd0 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -526,6 +526,9 @@ test_file_open(void) /* Close dataset from first open */ ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Pclose(fapl_id); + CHECK(ret, FAIL, "H5Pclose"); } /* test_file_open() */ /**************************************************************** @@ -1060,6 +1063,9 @@ test_get_file_id(void) VERIFY(fid2, FAIL, "H5Iget_file_id"); /* Close objects */ + ret = H5Pclose(plist); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Tclose(datatype_id); CHECK(ret, FAIL, "H5Tclose"); @@ -2855,7 +2861,7 @@ test_filespace_sects(void) test_free_sections(fapl_stdio, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_split); + h5_cleanup(FILENAME, fapl_stdio); /* CORE */ MESSAGE(5, ("Testing File free space information for a core file\n")); @@ -3223,6 +3229,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); + + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_libver_bounds_real() */ /**************************************************************** diff --git a/test/th5o.c b/test/th5o.c index c46751e..a470f4c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -111,6 +111,8 @@ test_h5o_open(void) CHECK(dspace, FAIL, "H5Dget_space"); /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); ret = H5Tclose(dtype); @@ -324,6 +326,8 @@ test_h5o_open_by_addr(void) CHECK(dspace, FAIL, "H5Dget_space"); /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); ret = H5Tclose(dtype); diff --git a/test/th5s.c b/test/th5s.c index a026545..ebbaa37 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -182,14 +182,13 @@ test_h5s_basic(void) fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); if (fid1 >= 0){ - dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); - VERIFY(dset1, FAIL, "H5Dopen2"); - ret = H5Fclose(fid1); - CHECK_I(ret, "H5Fclose"); + dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); + VERIFY(dset1, FAIL, "H5Dopen2"); + ret = H5Fclose(fid1); + CHECK_I(ret, "H5Fclose"); } else - printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", - testfile); + printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile); } /* Verify that incorrect dimensions don't work */ diff --git a/test/tsohm.c b/test/tsohm.c index a8d46f1..eb5f7c5 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3144,6 +3144,8 @@ static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id) /* Close the dataset and both files to make sure everything gets flushed * out of memory */ + ret = H5Sclose(space_id); + CHECK_I(ret, "H5Sclose"); ret = H5Dclose(dset_id); CHECK_I(ret, "H5Dclose"); ret = H5Fclose(src_file_id); @@ -3201,6 +3203,9 @@ test_sohm_extlink(void) test_sohm_extlink_helper(fcpl_id, H5P_DEFAULT); test_sohm_extlink_helper(H5P_DEFAULT, fcpl_id); test_sohm_extlink_helper(fcpl_id, fcpl_id); + + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); } @@ -3788,6 +3793,9 @@ test_sohm_extend_dset(void) CHECK_I(ret, "test_sohm_extend_dset_helper"); ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); CHECK_I(ret, "test_sohm_extend_dset_helper"); + + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); } -- cgit v0.12