]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
comm: pacify -fsanitizer=leak
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 31 Jan 2022 16:42:07 +0000 (08:42 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 31 Jan 2022 20:07:38 +0000 (12:07 -0800)
* src/comm.c (compare_files): Move exiting code here ...
(main): ... from here, to pacify gcc -fsanitize=leak.

src/comm.c

index dbb9933b5cffae5c57b55feabe97ecd7508e4d65..9cb7a61b0a2ee250ae4e13fea83ffccd31f8a492 100644 (file)
@@ -248,7 +248,8 @@ check_order (struct linebuffer const *prev,
 /* Compare INFILES[0] and INFILES[1].
    If either is "-", use the standard input for that file.
    Assume that each input file is sorted;
-   merge them and output the result.  */
+   merge them and output the result.
+   Exit the program when done.  */
 
 static void
 compare_files (char **infiles)
@@ -401,6 +402,12 @@ compare_files (char **infiles)
               umaxtostr (total[2], buf3), col_sep,
               _("total"), delim);
     }
+
+  if (issued_disorder_warning[0] || issued_disorder_warning[1])
+    die (EXIT_FAILURE, 0, _("input is not in sorted order"));
+
+  /* Exit here to pacify gcc -fsanitizer=leak.  */
+  exit (EXIT_SUCCESS);
 }
 
 int
@@ -491,9 +498,4 @@ main (int argc, char **argv)
     }
 
   compare_files (argv + optind);
-
-  if (issued_disorder_warning[0] || issued_disorder_warning[1])
-    die (EXIT_FAILURE, 0, _("input is not in sorted order"));
-  else
-    return EXIT_SUCCESS;
 }