Spenser Reinhardt 11 лет назад
Родитель
Сommit
5ea46a4ca6
2 измененных файлов с 9 добавлено и 1 удалено
  1. 8 0
      gl/getopt.c
  2. 1 1
      lib/utils_cmd.c

+ 8 - 0
gl/getopt.c

@@ -588,6 +588,14 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
           d->__nextchar += strlen (d->__nextchar);
           d->optind++;
           d->optopt = 0;
+
+          while (ambig_list != NULL)
+            {
+              struct option_list *pn = ambig_list->next;
+              free (ambig_list);
+              ambig_list = pn;
+            }
+
           return '?';
         }
 

+ 1 - 1
lib/utils_cmd.c

@@ -387,7 +387,7 @@ cmd_file_read ( char *filename, output *out, int flags)
 	if ((fd = open(filename, O_RDONLY)) == -1) {
 		die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) );
 	}
-	
+
 	if(out)
 		out->lines = _cmd_fetch_output (fd, out, flags);