All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Maxim Petrov <mmrmaximuzz@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] lnstat: fix strdup leak in -w argument parsing
Date: Wed, 16 Feb 2022 11:42:36 -0800	[thread overview]
Message-ID: <20220216114236.38018b4b@hermes.local> (raw)
In-Reply-To: <5ff8631c-1c57-9bc7-4da8-ae089a7c74a6@gmail.com>

On Wed, 16 Feb 2022 22:40:58 +0300
Maxim Petrov <mmrmaximuzz@gmail.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.

      reply	other threads:[~2022-02-16 19:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 20:53 [PATCH iproute2] lnstat: fix strdup leak in -w argument parsing Maxim Petrov
2022-02-15 22:49 ` Stephen Hemminger
2022-02-16 19:40   ` Maxim Petrov
2022-02-16 19:42     ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220216114236.38018b4b@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=mmrmaximuzz@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.