summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-03-19 20:51:14 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-03-19 20:51:14 (GMT)
commit8ad18f496ad665faffc4f2fd0eae8140b53ab760 (patch)
tree5e3e5d67c30b8d3153de4e2af20edc11b6ab5766 /tools
parent626fb1b02fee15e1954583f7ec06b3e09eb7bffc (diff)
downloadhdf5-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')
-rw-r--r--tools/misc/h5mkgrp.c13
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() */