Re: [PATCH 13/34] libmount: fix memory leak [clang-analyzer]

Karel Zak
2013-07-08T08:02:24Z

On Sun, Jul 07, 2013 at 08:54:28PM +0100, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
> libmount/src/utils.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libmount/src/utils.c b/libmount/src/utils.c
> index 1655764..7714b50 100644
> --- a/libmount/src/utils.c
> +++ b/libmount/src/utils.c
> @@ -198,6 +198,7 @@ int mnt_chdir_to_parent(const char *target, char **filename)
> else
> memcpy(*filename, last, strlen(last) + 1);
> }
else

> + free(buf);
> return 0;

Please, read the code and don't blindly follow analyzers.

Karel

--
Karel Zak <kzak@redhat.com>