coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] nl: free allocated strings to avoid valgrind warning


From: Daniel Lockyer
Subject: [PATCH] nl: free allocated strings to avoid valgrind warning
Date: Mon, 11 Apr 2016 18:30:10 +0100

* src/nl.c (main): free (with IF_LINT guarding) header_del, body_del,
    footer_del and print_no_line_fmt to keep valgrind quiet about
    not being free before exiting.
---
 src/nl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/nl.c b/src/nl.c
index a4a48bc..4064822 100644
--- a/src/nl.c
+++ b/src/nl.c
@@ -586,5 +586,10 @@ main (int argc, char **argv)
   if (have_read_stdin && fclose (stdin) == EOF)
     error (EXIT_FAILURE, errno, "-");
 
+  IF_LINT (free (header_del));
+  IF_LINT (free (body_del));
+  IF_LINT (free (footer_del));
+  IF_LINT (free (print_no_line_fmt));
+
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
2.8.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]