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 | |
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)
-rw-r--r-- | c++/src/H5CompType.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5DataType.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 2 | ||||
-rw-r--r-- | fortran/src/H5Ef.c | 12 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 2 | ||||
-rw-r--r-- | fortran/src/H5Tf.c | 4 | ||||
-rw-r--r-- | hl/src/H5LT.c | 6 | ||||
-rw-r--r-- | hl/src/H5TB.c | 30 | ||||
-rw-r--r-- | hl/test/test_lite.c | 12 | ||||
-rw-r--r-- | src/H5.c | 25 | ||||
-rw-r--r-- | src/H5public.h | 1 | ||||
-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 | ||||
-rw-r--r-- | tools/h5dump/h5dump_xml.c | 9 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 2 | ||||
-rw-r--r-- | tools/misc/talign.c | 6 |
22 files changed, 110 insertions, 84 deletions
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 1846846..191f004 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -123,7 +123,7 @@ H5std_string CompType::getMemberName( unsigned member_num ) const "H5Tget_member_name returns NULL for member name"); } H5std_string member_name = H5std_string(member_name_C); // convert C string to string - HDfree(member_name_C); // free the C string + H5free_memory(member_name_C); // free the C string return( member_name ); // return the member name string } diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 00aa5f4..4c3cc62 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -563,7 +563,7 @@ H5std_string DataType::getTag() const if( tag_Cstr != NULL ) { H5std_string tag = H5std_string(tag_Cstr); // C string to string object - HDfree(tag_Cstr); // free the C string + H5free_memory(tag_Cstr); // free the C string return (tag); // return the tag } else diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index a49995d..0b740d8 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -490,7 +490,7 @@ H5std_string PropList::getClassName() const if (temp_str != NULL) { H5std_string class_name(temp_str); - HDfree(temp_str); + H5free_memory(temp_str); return(class_name); } else diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c index 8671b18..8677977 100644 --- a/fortran/src/H5Ef.c +++ b/fortran/src/H5Ef.c @@ -143,8 +143,8 @@ done: * NAME * h5eget_major_c * PURPOSE - * Call H5Eget_major to get a character string - * describing an error specified by a major error number. + * Get a character string describing an error specified by a + * major error number. * INPUTS * error_no - Major error number * OUTPUTS @@ -173,7 +173,7 @@ nh5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen) HGOTO_DONE(FAIL) /* - * Call H5Eget_major function. + * Call H5Eget_msg function. */ H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen); @@ -191,8 +191,8 @@ done: * NAME * h5eget_minor_c * PURPOSE - * Call H5Eget_minor to get a character string - * describing an error specified by a minor error number. + * Get a character string describing an error specified by a + * minor error number. * INPUTS * error_no - Major error number * OUTPUTS @@ -221,7 +221,7 @@ nh5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen) HGOTO_DONE(FAIL) /* - * Call H5Eget_minor function. + * Call H5Eget_msg function. */ H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen); diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index cf10efc..7a3f899 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3388,7 +3388,7 @@ nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); ret_value = (int_f)HDstrlen(c_name); - HDfree(c_name); + H5free_memory(c_name); DONE: return ret_value; diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index c8ff6e0..df581ee 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -1280,7 +1280,7 @@ nh5tget_member_name_c ( hid_t_f *type_id ,int_f* idx, _fcd member_name, int_f *n HD5packFstring(c_name, _fcdtocp(member_name), strlen(c_name)); *namelen = (int_f)strlen(c_name); - HDfree(c_name); + H5free_memory(c_name); ret_value = 0; return ret_value; } @@ -1986,7 +1986,7 @@ nh5tget_tag_c(hid_t_f* type_id, _fcd tag, size_t_f* tag_size, int_f* taglen) HD5packFstring(c_tag, _fcdtocp(tag), (size_t)*tag_size); *taglen = (int_f)HDstrlen(c_tag); - HDfree(c_tag); + H5free_memory(c_tag); ret_value = 0; return ret_value; } diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index aabd828..6003c60 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2359,7 +2359,7 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) /* Release resources */ for(i = 0; i < nmembs; i++) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); HDfree(value); @@ -2744,7 +2744,7 @@ next: if(tag) { HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag); if(tag) - HDfree(tag); + H5free_memory(tag); tag = NULL; } else HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n"); @@ -2950,7 +2950,7 @@ next: if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; if(mname) - HDfree(mname); + H5free_memory(mname); mname = NULL; HDsnprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset); diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 1547e00..99860b8 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -196,7 +196,7 @@ herr_t H5TBmake_table( const char *table_title, if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0) goto out; - HDfree( member_name ); + H5free_memory( member_name ); } @@ -234,7 +234,7 @@ herr_t H5TBmake_table( const char *table_title, if (H5Aclose(attr_id) < 0) goto out; - HDfree(member_name); + H5free_memory(member_name); } /* terminate access to the data space. */ @@ -570,7 +570,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, goto out; } - HDfree( member_name ); + H5free_memory( member_name ); } @@ -734,7 +734,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, if(H5Tclose( nmtype_id ) < 0) goto out; - HDfree( member_name ); + H5free_memory( member_name ); } @@ -1059,7 +1059,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, goto out; j++; } - HDfree( member_name ); + H5free_memory( member_name ); } /* get the dataspace handle */ @@ -1221,7 +1221,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, if (H5Tclose( nmtype_id ) < 0) goto out; - HDfree( member_name ); + H5free_memory( member_name ); } /* get the dataspace handle */ @@ -2314,7 +2314,7 @@ herr_t H5TBinsert_field( hid_t loc_id, curr_offset += member_size; - HDfree( member_name ); + H5free_memory( member_name ); /* close the member type */ if(H5Tclose( member_type_id ) < 0) @@ -2694,13 +2694,13 @@ herr_t H5TBdelete_field( hid_t loc_id, if (H5Tclose( member_type_id ) < 0) goto out; - HDfree( member_name ); + H5free_memory( member_name ); break; } - HDfree( member_name ); + H5free_memory( member_name ); } /* i */ @@ -2742,7 +2742,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* we want to skip the field to delete */ if (H5TB_find_field( member_name, field_name ) > 0 ) { - HDfree( member_name ); + H5free_memory( member_name ); continue; } @@ -2780,7 +2780,7 @@ herr_t H5TBdelete_field( hid_t loc_id, curr_offset += member_size; - HDfree(member_name); + H5free_memory(member_name); /* close the member type */ if (H5Tclose(member_type_id) < 0) @@ -2821,7 +2821,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* skip the field to delete */ if (H5TB_find_field(member_name, field_name) > 0) { - HDfree(member_name); + H5free_memory(member_name); continue; } @@ -2881,7 +2881,7 @@ herr_t H5TBdelete_field( hid_t loc_id, goto out; /* release resources. */ - HDfree( member_name ); + H5free_memory( member_name ); HDfree ( tmp_buf ); } /* i */ @@ -3306,7 +3306,7 @@ herr_t H5TBget_field_info( hid_t loc_id, member_name = H5Tget_member_name(tid, (unsigned)i); strcpy(field_names[i], member_name); - HDfree(member_name); + H5free_memory(member_name); } /* end if */ /* get the member type */ @@ -3459,7 +3459,7 @@ herr_t H5TB_attach_attributes( const char *table_title, if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0) goto out; - HDfree( member_name ); + H5free_memory( member_name ); } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index bcf6663..cb13061 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1551,10 +1551,10 @@ static int test_compounds(void) if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; if(HDstrcmp(memb_name, "i16_field")) { - HDfree(memb_name); + H5free_memory(memb_name); goto out; } - HDfree(memb_name); + H5free_memory(memb_name); if((memb_class = H5Tget_member_class(dtype, 2))<0) goto out; @@ -1619,10 +1619,10 @@ static int test_compound_bug(void) if((memb_name = H5Tget_member_name(dtype, 2)) == NULL) goto out; if(HDstrcmp(memb_name, "sub")) { - HDfree(memb_name); + H5free_memory(memb_name); goto out; } - HDfree(memb_name); + H5free_memory(memb_name); if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; @@ -1656,10 +1656,10 @@ static int test_compound_bug(void) if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; if(HDstrcmp(memb_name, "desc_________________________________________________________________________________________")) { - HDfree(memb_name); + H5free_memory(memb_name); goto out; } - HDfree(memb_name); + H5free_memory(memb_name); if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; @@ -806,3 +806,28 @@ H5close(void) FUNC_LEAVE_API_NOFS(SUCCEED) } /* end H5close() */ + +/*------------------------------------------------------------------------- + * Function: H5free_memory + * + * Purpose: Frees memory allocated by the library that it is the user's + * responsibility to free. Ensures that the same library + * that was used to allocate the memory frees it. Passing + * NULL pointers is allowed. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5free_memory(void *mem) +{ + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "*x", mem); + + /* At this time, it is impossible for this to fail. */ + HDfree(mem); + + FUNC_LEAVE_API(SUCCEED) +} /* end H5free_memory() */ + diff --git a/src/H5public.h b/src/H5public.h index 00eb619..9312f15 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -334,6 +334,7 @@ H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum); +H5_DLL herr_t H5free_memory(void *mem); #ifdef __cplusplus } 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"); diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index b94879c..c081ee0 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -1216,7 +1216,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); - HDfree(mname); + H5free_memory(mname); size = H5Tget_size(type); h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); @@ -1265,7 +1265,7 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(mname); + H5free_memory(mname); HDfree(t_fname); dump_indent += COL; ctx.indent_level++; @@ -3623,7 +3623,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", name); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - + if(name) + H5free_memory(name); ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -4526,7 +4527,7 @@ xml_print_enum(hid_t type) /* Release resources */ for (i = 0; i < nmembs; i++) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); HDfree(value); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 14fdb65..33fc17a 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -845,7 +845,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) n = print_string(buffer, name, FALSE); h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i)); - HDfree(name); + H5free_memory(name); /* Member's type */ subtype = H5Tget_member_type(type, i); @@ -927,7 +927,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) { /* Release resources */ for(i = 0; i < (unsigned)nmembs; i++) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); HDfree(value); @@ -1154,7 +1154,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer, "\n%*s(tag = \"", ind, ""); print_string(buffer, tag, FALSE); h5tools_str_append(buffer, "\")"); - HDfree(tag); + H5free_memory(tag); } return TRUE; } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index e1fdd4b..3432a8b 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2336,7 +2336,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - HDfree(ttag); + H5free_memory(ttag); } ctx->indent_level--; @@ -2372,7 +2372,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ } else HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); - HDfree(mname); + H5free_memory(mname); } ctx->indent_level--; @@ -2688,7 +2688,7 @@ CATCH /* Release resources */ for(i = 0; i < nmembs; i++) if(name[i]) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); } /* end if */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 34142d4..3160cfa 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -991,7 +991,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* The name */ name = H5Tget_member_name(type, j); h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - HDfree(name); + H5free_memory(name); /* The value */ offset = H5Tget_member_offset(type, j); diff --git a/tools/misc/talign.c b/tools/misc/talign.c index 66318bf..2d0a9d1 100644 --- a/tools/misc/talign.c +++ b/tools/misc/talign.c @@ -152,7 +152,7 @@ out: mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0), string5, (char *)(data + H5Tget_member_offset(fix, 0))); if(mname) - HDfree(mname); + H5free_memory(mname); fptr = (float *)(data + H5Tget_member_offset(fix, 1)); mname = H5Tget_member_name(fix, 1); @@ -163,7 +163,7 @@ out: (double)fok[0], (double)fptr[0], (double)fok[1], (double)fptr[1]); if(mname) - HDfree(mname); + H5free_memory(mname); fptr = (float *)(data + H5Tget_member_offset(fix, 2)); mname = H5Tget_member_name(fix, 2); @@ -173,7 +173,7 @@ out: (double)fnok[0], (double)fptr[0], (double)fnok[1], (double)fptr[1]); if(mname) - HDfree(mname); + H5free_memory(mname); fptr = (float *)(data + H5Tget_member_offset(fix, 1)); printf("\n" |