coreutils
[Top][All Lists]
Advanced

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

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


From: Pádraig Brady
Subject: Re: [PATCH] nl: free allocated strings to avoid valgrind warning
Date: Mon, 11 Apr 2016 18:44:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/04/16 18:30, Daniel Lockyer wrote:
* 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;
  }


This is just a "still reachable" warning I think.
We only consider freeing stuff when valgrind marks it as "definitely lost",
which was the case for your previous date.c patch but not here?

cheers,
Pádraig



reply via email to

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