X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=adu.c;h=787b0e899d18cb86b20c53263603bcee735ba8ec;hb=c9621313e2699755e65d6424fd4546c33924f272;hp=ed1b4fa32aee7dac5a7650f2074f8f37df2820d1;hpb=e584cd6d5a3782ddeb6640f69534ab1664da2605;p=adu.git diff --git a/adu.c b/adu.c index ed1b4fa..787b0e8 100644 --- a/adu.c +++ b/adu.c @@ -182,7 +182,6 @@ static int check_args(void) static int print_complete_help_and_die(void) { const char **line; - select_cmdline_parser_init(&select_conf); printf("%s-%s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); printf("%s\n\n", gengetopt_args_info_purpose); @@ -205,6 +204,8 @@ static int print_complete_help_and_die(void) printf("Interactive commands:\n"); print_interactive_help(); + cmdline_parser_free(&conf); + select_cmdline_parser_free(&select_conf); exit(EXIT_FAILURE); } @@ -212,16 +213,19 @@ int main(int argc, char **argv) { int ret; struct cmdline_parser_params params = { - .override = 0, + .override = 1, .initialize = 1, .check_required = 0, .check_ambiguity = 0, .print_errors = 0 }; + select_cmdline_parser_init(&select_conf); + cmdline_parser_init(&conf); /* ignore errors and print complete help if --help was given */ cmdline_parser_ext(argc, argv, &conf, ¶ms); if (conf.help_given || conf.detailed_help_given) print_complete_help_and_die(); + cmdline_parser_free(&conf); params.check_required = 1; params.check_ambiguity = 1; params.print_errors = 1; @@ -249,5 +253,7 @@ out: ERROR_LOG("%s\n", adu_strerror(-ret)); return -EXIT_FAILURE; } + cmdline_parser_free(&conf); + select_cmdline_parser_free(&select_conf); return EXIT_SUCCESS; }