[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] tsort: suppress a valgrind memory leak warning
From: |
Jim Meyering |
Subject: |
Re: [coreutils] [PATCH] tsort: suppress a valgrind memory leak warning |
Date: |
Fri, 26 Nov 2010 12:07:42 +0100 |
Pádraig Brady wrote:
> This is the only "definitely lost" warning left
> from valgrind --tool=memcheck.
Good. Thanks!
> commit c8b88772b61ffb3d9f73fc6b9985ec7b35495f87
> Author: Pádraig Brady <address@hidden>
> 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--;