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 /tools | |
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 'tools')
-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 |
5 files changed, 15 insertions, 14 deletions
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 f8933c6..257d4d1 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -849,7 +849,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); @@ -931,7 +931,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); @@ -1158,7 +1158,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 7492d8a..f11065c 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2340,7 +2340,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--; @@ -2376,7 +2376,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--; @@ -2692,7 +2692,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 9202925..d43fc33 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 017eb55..3fd1694 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) - free(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) - free(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) - free(mname); + H5free_memory(mname); fptr = (float *)(data + H5Tget_member_offset(fix, 1)); printf("\n" |