From 2705253d2c78e19e44e1b7e8c6dcc220de3c82d1 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 9 Feb 2005 13:16:36 +0000 Subject: fix --- opts.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'opts.c') diff --git a/opts.c b/opts.c index 3e3e34a..ab39f36 100644 --- a/opts.c +++ b/opts.c @@ -83,12 +83,17 @@ void process_options(int *argcp, char *argv[], struct opt opts[], argctr++; arg = argv[argctr]; removed = process_option_group(arg, opts, case_sensitive); - if (!removed && argctr != newargctr) + if (removed) + free(argv[argctr-1]); + else if (argctr != newargctr) argv[newargctr++] = argv[argctr-1]; + } } } - if (!removed) { + if (removed) + free(arg); + else { if(argctr != newargctr) argv[newargctr] = arg; newargctr++; @@ -96,4 +101,3 @@ void process_options(int *argcp, char *argv[], struct opt opts[], } *argcp = newargctr; } - -- cgit v1.2.3