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: Daniel Lockyer
Subject: Re: [PATCH] nl: free allocated strings to avoid valgrind warning
Date: Mon, 11 Apr 2016 18:56:21 +0100

On Mon, Apr 11, 2016 at 06:44:41PM +0100, Pádraig Brady wrote:
> 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

You are correct, it is. I didn't know that was a condition but no
worries, I'll keep searching!

Thanks,
Daniel



reply via email to

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