diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2013-03-19 20:51:14 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2013-03-19 20:51:14 (GMT) |
commit | 8ad18f496ad665faffc4f2fd0eae8140b53ab760 (patch) | |
tree | 5e3e5d67c30b8d3153de4e2af20edc11b6ab5766 /tools/misc | |
parent | 626fb1b02fee15e1954583f7ec06b3e09eb7bffc (diff) | |
download | hdf5-8ad18f496ad665faffc4f2fd0eae8140b53ab760.zip hdf5-8ad18f496ad665faffc4f2fd0eae8140b53ab760.tar.gz hdf5-8ad18f496ad665faffc4f2fd0eae8140b53ab760.tar.bz2 |
[svn-r23388] HDDFV-8322: Free allocations in parse_command_line function.
Tested: local linux
Diffstat (limited to 'tools/misc')
-rw-r--r-- | tools/misc/h5mkgrp.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index b4ac6f6..b9fb588 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -46,6 +46,7 @@ typedef struct { size_t ngroups; /* Number of groups to create */ char **groups; /* Pointer to array of group names */ } param_t; +param_t params; /* Command line parameter settings */ /*------------------------------------------------------------------------- @@ -62,6 +63,15 @@ typedef struct { static void leave(int ret) { + int curr_group; + + if (params.fname) + HDfree (params.fname); + if (params.ngroups) { + for(curr_group = 0; curr_group < params.ngroups; curr_group++) + HDfree (params.groups[curr_group]); + HDfree (params.groups); + } h5tools_close(); HDexit(ret); } /* end leave() */ @@ -206,7 +216,6 @@ for(curr_group = 0; curr_group < params->ngroups; curr_group++) int main(int argc, const char *argv[]) { - param_t params; /* Command line parameter settings */ hid_t fid; /* HDF5 file ID */ hid_t fapl_id; /* File access property list ID */ hid_t lcpl_id; /* Link creation property list ID */ @@ -322,6 +331,6 @@ main(int argc, const char *argv[]) /* Shut down h5tools lib */ h5tools_close(); - return EXIT_SUCCESS; + leave(EXIT_SUCCESS); } /* end main() */ |