[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220216114236.38018b4b@hermes.local>
Date: Wed, 16 Feb 2022 11:42:36 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Maxim Petrov <mmrmaximuzz@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] lnstat: fix strdup leak in -w argument parsing
On Wed, 16 Feb 2022 22:40:58 +0300
Maxim Petrov <mmrmaximuzz@...il.com> wrote:
> On 2022-02-15 22:49 UTC, Stephen Hemminger wrote:
> > Would strdupa() be cleaner/simpler.
>
> strdupa will not free the allocated memory until the caller returns. In our
> case the caller is 'main', so despite valgrind will be happy, the memory
> will be wasted anyway.
>
> However, I guess that the option is mostly used just like '-w 20', so the
> _wasted anyway_ strdupa memory is only about a few bytes in these cases,
> and from this perspective I also have no strong preference. But I don't
> know how this option is used by others.
There are not a lot of paths through the code in main, so not a bit worry.
Powered by blists - more mailing lists