diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2014-03-31 23:35:09 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2014-03-31 23:35:09 (GMT) |
commit | d01ee66666f4cad8e5f3f67a51a5774adcc03e45 (patch) | |
tree | 1980b2237af734a2784314b85a8b8f4edbfcf14e /test | |
parent | ef9db69bf33a200f81ebb3e29dbcbbdab92938cf (diff) | |
download | hdf5-d01ee66666f4cad8e5f3f67a51a5774adcc03e45.zip hdf5-d01ee66666f4cad8e5f3f67a51a5774adcc03e45.tar.gz hdf5-d01ee66666f4cad8e5f3f67a51a5774adcc03e45.tar.bz2 |
[svn-r24937] Adds an H5free_memory() function to the library for use with
functions that return library-allocated memory. The test and tool
code were modified to use this new function where it's appropriate.
Fixes HDFFV-7710, HDFFV-8519, and HDFFV-8551
Tested on:
64-bit Windows 7 w/ VS2012
32-bit LE linux w/ parallel and fortran (jam)
32-bit LE linux w/ fortran and C++ (jam)
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 13 | ||||
-rw-r--r-- | test/err_compat.c | 16 | ||||
-rw-r--r-- | test/tarray.c | 22 | ||||
-rw-r--r-- | test/tattr.c | 2 | ||||
-rw-r--r-- | test/tgenprop.c | 10 | ||||
-rw-r--r-- | test/tunicode.c | 4 |
6 files changed, 33 insertions, 34 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index 5826097..f297b58 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -651,7 +651,7 @@ test_compound_1(void) error: if(tag) - HDfree(tag); + H5free_memory(tag); return retval; } @@ -4422,7 +4422,7 @@ error: if(buf) HDfree(buf); if(tag) - HDfree(tag); + H5free_memory(tag); /* Technically allocated by API call */ reset_hdf5(); return ret_value; /* Number of errors */ @@ -4790,8 +4790,7 @@ test_bitfield_funcs(void) error: if (retval == -1) retval = 1; - - HDfree(tag); + H5free_memory(tag); H5Tclose(ntype); H5Tclose(type); if (retval == 0) PASSED(); @@ -6473,7 +6472,7 @@ test_named_indirect_reopen(hid_t fapl) if(dt_size != H5Tget_size(type)) TEST_ERROR if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR if(HDstrcmp(tag, tag_ret)) TEST_ERROR - HDfree(tag_ret); + H5free_memory(tag_ret); tag_ret = NULL; /* Create dataset with opaque type */ @@ -6484,7 +6483,7 @@ test_named_indirect_reopen(hid_t fapl) if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR if(HDstrcmp(tag, tag_ret)) TEST_ERROR - HDfree(tag_ret); + H5free_memory(tag_ret); tag_ret = NULL; /* Close types and dataset */ @@ -6534,7 +6533,7 @@ error: H5Fclose(file); } H5E_END_TRY; if(tag_ret) - HDfree(tag_ret); + H5free_memory(tag_ret); return 1; } /* end test_named_indirect_reopen() */ diff --git a/test/err_compat.c b/test/err_compat.c index c08e259..346d397 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -144,16 +144,16 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); - HDfree(maj); - HDfree(min); + H5free_memory(maj); + H5free_memory(min); return 0; error: if(maj) - HDfree(maj); + H5free_memory(maj); if(min) - HDfree(min); + H5free_memory(min); return -1; } @@ -197,16 +197,16 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); - HDfree(maj); - HDfree(min); + H5free_memory(maj); + H5free_memory(min); return 0; error: if(maj) - HDfree(maj); + H5free_memory(maj); if(min) - HDfree(min); + H5free_memory(min); return -1; } diff --git a/test/tarray.c b/test/tarray.c index e3999bb..1a53336 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -637,7 +637,7 @@ test_array_compound_atomic(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname, "i") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); - HDfree(mname); + H5free_memory(mname); /* Check the 1st field's offset */ off = H5Tget_member_offset(tid2, 0); @@ -656,7 +656,7 @@ test_array_compound_atomic(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname, "f") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); - HDfree(mname); + H5free_memory(mname); /* Check the 2nd field's offset */ off = H5Tget_member_offset(tid2, 1); @@ -849,7 +849,7 @@ test_array_compound_array(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - HDfree(mname); + H5free_memory(mname); /* Check the 1st field's offset */ off=H5Tget_member_offset(tid2,0); @@ -868,7 +868,7 @@ test_array_compound_array(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - HDfree(mname); + H5free_memory(mname); /* Check the 2nd field's offset */ off=H5Tget_member_offset(tid2,1); @@ -1848,7 +1848,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - HDfree(mname); + H5free_memory(mname); /* Check the 1st field's offset */ off=H5Tget_member_offset(tid1,0); @@ -1867,7 +1867,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - HDfree(mname); + H5free_memory(mname); /* Check the 2nd field's offset */ off=H5Tget_member_offset(tid1,1); @@ -1886,7 +1886,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - HDfree(mname); + H5free_memory(mname); /* Check the 3rd field's offset */ off=H5Tget_member_offset(tid1,2); @@ -1930,7 +1930,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) HDfree(mname); + if(mname) H5free_memory(mname); /* Check the 1st field's offset */ off=H5Tget_member_offset(tid1,0); @@ -1949,7 +1949,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) HDfree(mname); + if(mname) H5free_memory(mname); /* Check the 2nd field's offset */ off=H5Tget_member_offset(tid1,1); @@ -1994,7 +1994,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) HDfree(mname); + if(mname) H5free_memory(mname); /* Check the 3rd field's offset */ off=H5Tget_member_offset(tid1,2); @@ -2039,7 +2039,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"d")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) HDfree(mname); + if(mname) H5free_memory(mname); /* Check the 4th field's offset */ off=H5Tget_member_offset(tid1,3); diff --git a/test/tattr.c b/test/tattr.c index a5a61bc..962883f 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -829,7 +829,7 @@ test_attr_compound_read(hid_t fapl) HDstrcmp(fieldname, ATTR4_FIELDNAME2) || HDstrcmp(fieldname, ATTR4_FIELDNAME3))) TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname); - HDfree(fieldname); + H5free_memory(fieldname); } /* end for */ offset = H5Tget_member_offset(type, 0); VERIFY(offset, attr4_field1_off, "H5Tget_member_offset"); diff --git a/test/tgenprop.c b/test/tgenprop.c index 5f8d8f5..004e346 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -88,7 +88,7 @@ test_genprop_basic_class(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Check class parent */ cid2 = H5Pget_class_parent(cid1); @@ -119,7 +119,7 @@ test_genprop_basic_class(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS2_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME); - HDfree(name); + H5free_memory(name); /* Check class parent */ cid2 = H5Pget_class_parent(cid1); @@ -1868,7 +1868,7 @@ test_genprop_refcount(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Close class */ ret = H5Pclose_class(cid1); @@ -1887,7 +1887,7 @@ test_genprop_refcount(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Close list */ ret = H5Pclose(lid1); @@ -1898,7 +1898,7 @@ test_genprop_refcount(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Close class */ ret = H5Pclose_class(cid1); diff --git a/test/tunicode.c b/test/tunicode.c index 7793ea3..10ddddd 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -602,7 +602,7 @@ void test_compound(hid_t fid, const char * string) readbuf = H5Tget_member_name(s1_tid, 0); ret = HDstrcmp(readbuf, string); VERIFY(ret, 0, "strcmp"); - HDfree(readbuf); + H5free_memory(readbuf); /* Add the other fields to the datatype */ ret = H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); @@ -715,7 +715,7 @@ void test_opaque(hid_t UNUSED fid, const char * string) read_buf = H5Tget_tag(type_id); ret = strcmp(read_buf, string); VERIFY(ret, 0, "H5Tget_tag"); - HDfree(read_buf); + H5free_memory(read_buf); ret = H5Tclose(type_id); CHECK(ret, FAIL, "H5Tclose"); |