diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-05-20 14:44:55 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-05-20 14:44:55 (GMT) |
commit | 0982e11bb483c73b827237ce59886dce93a8fba9 (patch) | |
tree | 827c7019758337912499ed254a719d39a02ef970 /tools | |
parent | f9174cbd9d45c71744045981ada2a015239508b5 (diff) | |
download | hdf5-0982e11bb483c73b827237ce59886dce93a8fba9.zip hdf5-0982e11bb483c73b827237ce59886dce93a8fba9.tar.gz hdf5-0982e11bb483c73b827237ce59886dce93a8fba9.tar.bz2 |
[svn-r20871] Added function to free iter structure allocations.
Tested: local linux - Confirmed by Valgrind
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5stat/h5stat.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index b7026cc..98243fe 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -968,6 +968,45 @@ iter_init(iter_t *iter, hid_t fid) /*------------------------------------------------------------------------- + * Function: free_iter + * + * Purpose: Freee iter structure + * + * Return: Success: 0 + * + * Failure: Never fails + * + *------------------------------------------------------------------------- + */ +static herr_t +iter_free(iter_t *iter) +{ + /* Clear array of bins for group counts */ + if(iter->group_bins) + free(iter->group_bins); + iter->group_bins = NULL; + /* Clear array of bins for attribute counts */ + if(iter->attr_bins) + free(iter->attr_bins); + iter->attr_bins = NULL; + /* Clear dataset datatype information found */ + if(iter->dset_type_info) + free(iter->dset_type_info); + iter->dset_type_info = NULL; + /* Clear array of bins for dataset dimensions */ + if(iter->dset_dim_bins) + free(iter->dset_dim_bins); + iter->dset_dim_bins = NULL; + /* Clear array of bins for free-space section sizes */ + if(iter->sect_bins) + free(iter->sect_bins); + iter->sect_bins = NULL; + + return 0; +} + + +/*------------------------------------------------------------------------- * Function: print_file_info * * Purpose: Prints information about file @@ -1671,6 +1710,9 @@ done: free(hand); hand = NULL; + + /* Free iter structure */ + iter_free(&iter); if(H5Fclose(fid) < 0) { error_msg("unable to close file \"%s\"\n", fname); |