From: Maxim Petrov <mmrmaximuzz@gmail.com>
To: stephen@networkplumber.org
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] lnstat: fix strdup leak in -w argument parsing
Date: Wed, 16 Feb 2022 22:40:58 +0300 [thread overview]
Message-ID: <5ff8631c-1c57-9bc7-4da8-ae089a7c74a6@gmail.com> (raw)
In-Reply-To: <20220215144901.1ba007a1@hermes.local>
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.
next prev parent reply other threads:[~2022-02-16 19:41 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 [this message]
2022-02-16 19:42 ` Stephen Hemminger
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=5ff8631c-1c57-9bc7-4da8-ae089a7c74a6@gmail.com \
--to=mmrmaximuzz@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).