diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2014-04-11 14:48:31 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2014-04-11 14:48:31 (GMT) |
commit | 8a524752454c04a07a378b39abc929fd8948d91b (patch) | |
tree | e6ad7cc080461c68bdc7dda04df9da07026ce3a2 /hl | |
parent | 6240fb24e6e06039dada4bc7e23ca1a211a0ab2c (diff) | |
download | hdf5-8a524752454c04a07a378b39abc929fd8948d91b.zip hdf5-8a524752454c04a07a378b39abc929fd8948d91b.tar.gz hdf5-8a524752454c04a07a378b39abc929fd8948d91b.tar.bz2 |
[svn-r25014] Purpose:
Merge of r24937 from the trunk
Adds H5free_memory to the API. This function should be used to free
memory allocated by the library (e.g., returned values from
H5Tget_tag, H5Pget_class_name, etc.).
This is mainly to help Windows applications deal with multiple CRT
instances, but can also be helpful when a debug memory manager is
being used or when the HDF5 API is being wrapped for managed languages
like Python and Java.
Tested on:
32-bit LE linux (jam) with fortran and C++
64-bit BE linux (ostrich)
64-bit LE linux (koala)
Diffstat (limited to 'hl')
-rw-r--r-- | hl/src/H5LT.c | 6 | ||||
-rw-r--r-- | hl/src/H5TB.c | 32 | ||||
-rw-r--r-- | hl/test/test_lite.c | 12 |
3 files changed, 25 insertions, 25 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 96cd014..6da097c 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2360,7 +2360,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); @@ -2745,7 +2745,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"); @@ -2951,7 +2951,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 0b6305b..0fa23bc 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; - free( 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; - free(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; } - free( 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; - free( member_name ); + H5free_memory( member_name ); } @@ -1059,7 +1059,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, goto out; j++; } - free( 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; - free( 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; - free( 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; - free( member_name ); + H5free_memory( member_name ); break; } - free( 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 ) { - free( member_name ); + H5free_memory( member_name ); continue; } @@ -2780,7 +2780,7 @@ herr_t H5TBdelete_field( hid_t loc_id, curr_offset += member_size; - free(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) { - free(member_name); + H5free_memory(member_name); continue; } @@ -2881,8 +2881,8 @@ herr_t H5TBdelete_field( hid_t loc_id, goto out; /* release resources. */ - free( member_name ); - free ( tmp_buf ); + 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); - free(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; - free( member_name ); + H5free_memory( member_name ); } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index ad17206..a76f3d7 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; |