From: Thomas Monjalon <thomas@monjalon.net>
To: Ziye Yang <ziye.yang@intel.com>
Cc: dev@dpdk.org, konstantin.ananyev@intel.com,
Ziye Yang <optimistyzy@gmail.com>,
ferruh.yigit@intel.com
Subject: Re: [dpdk-dev] [PATCH v8] linuxapp, eal: Fix the memory leak issue of logid
Date: Sun, 28 Oct 2018 11:41:50 +0100 [thread overview]
Message-ID: <2291161.Cnx30EFnGb@xps> (raw)
In-Reply-To: <30207781.zVJTsycACh@xps>
22/10/2018 10:00, Thomas Monjalon:
> 12/09/2018 03:31, Ziye Yang:
> > From: Ziye Yang <optimistyzy@gmail.com>
> >
> > This patch is used to fix the memory leak issue of logid.
> > We use the ASAN test in SPDK when intergrating DPDK and
> > find this memory leak issue.
> >
> > Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> > ---
> > - logid = strrchr(argv[0], '/');
> > - logid = strdup(logid ? logid + 1: argv[0]);
> > -
> > + p = strrchr(argv[0], '/');
> > + snprintf(logid, sizeof(logid), "%s", (p ? p + 1 : argv[0]));
>
> Shouldn't it be strlcpy instead of snprintf?
Applied with suggested replacement:
- snprintf(logid, sizeof(logid), "%s", (p ? p + 1 : argv[0]));
+ strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid));
prev parent reply other threads:[~2018-10-28 10:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 5:39 [dpdk-dev] [PATCH v5] " Ziye Yang
2018-09-10 11:54 ` Ananyev, Konstantin
2018-09-10 11:58 ` Yang, Ziye
2018-09-10 12:19 ` Ananyev, Konstantin
2018-09-10 12:23 ` Yang, Ziye
2018-09-10 13:46 ` [dpdk-dev] [PATCH v6] " Ziye Yang
2018-09-11 1:27 ` [dpdk-dev] [PATCH v7] " Ziye Yang
2018-09-11 10:09 ` Ananyev, Konstantin
2018-09-11 13:47 ` Aaron Conole
2018-09-11 14:06 ` Ananyev, Konstantin
2018-09-11 15:27 ` Aaron Conole
2018-09-13 13:28 ` Aaron Conole
2018-09-12 1:31 ` [dpdk-dev] [PATCH v8] " Ziye Yang
2018-10-16 15:33 ` Ferruh Yigit
2018-10-22 8:00 ` Thomas Monjalon
2018-10-28 10:41 ` Thomas Monjalon [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=2291161.Cnx30EFnGb@xps \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=optimistyzy@gmail.com \
--cc=ziye.yang@intel.com \
/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).