[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: [coreutils] [PATCH] tsort: suppress a valgrind memory leak warning
From:       Jim Meyering <jim () meyering ! net>
Date:       2010-11-26 11:07:42
Message-ID: 871v68737l.fsf () meyering ! net
[Download RAW message or body]

Pádraig Brady wrote:
> This is the only "definitely lost" warning left
> from valgrind --tool=memcheck.

Good.  Thanks!

> commit c8b88772b61ffb3d9f73fc6b9985ec7b35495f87
> Author: Pádraig Brady <P@draigBrady.com>
> Date:   Thu Nov 25 19:16:00 2010 +0000
>
>     tsort: suppress a valgrind memory leak warning
>
>     * src/tsort.c (tsort): Unconditionally invoking the free()
>     doesn't increase scalability, so do it only with -Dlint
>
> diff --git a/src/tsort.c b/src/tsort.c
> index 4f51f30..b27cdfa 100644
> --- a/src/tsort.c
> +++ b/src/tsort.c
> @@ -487,6 +487,10 @@ tsort (const char *file)
>
>            /* T5. Output front of queue.  */
>            puts (head->str);
> +#ifdef lint
> +          /* suppress valgrind "definitely lost" warnings.  */
> +          free ((void *) head->str);
> +#endif
>            head->str = NULL;    /* Avoid printing the same string twice.  */
>            n_strings--;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic