From b384f8147ebf219cd88d4fae420f7dcef19b825d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 31 Jan 2022 08:42:07 -0800 Subject: [PATCH 02/43] comm: pacify -fsanitizer=leak * src/comm.c (compare_files): Move exiting code here ... (main): ... from here, to pacify gcc -fsanitize=leak. --- src/comm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/comm.c b/src/comm.c index dbb9933b5..9cb7a61b0 100644 --- a/src/comm.c +++ b/src/comm.c @@ -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; } -- 2.32.0