From: "Yu, DapengX" <dapengx.yu@intel.com>
To: "Singh, Jasvinder" <jasvinder.singh@intel.com>,
"Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3] net/softnic: fix memory leak in parsing arguments
Date: Thu, 15 Jul 2021 01:42:43 +0000 [thread overview]
Message-ID: <PH0PR11MB512556FCE643F6C97CC3C1378C129@PH0PR11MB5125.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BN9PR11MB5258E39B4285A9D3F5EF7E9FE0139@BN9PR11MB5258.namprd11.prod.outlook.com>
> -----Original Message-----
> From: Singh, Jasvinder <jasvinder.singh@intel.com>
> Sent: Wednesday, July 14, 2021 7:08 PM
> To: Yu, DapengX <dapengx.yu@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v3] net/softnic: fix memory leak in parsing arguments
>
> <snip>
>
> > + free(firmware);
>
> Memory for firmware is not allocated dynamically, so no need for this.
I have double checked it, at this code snippet, the memory block referenced by the "firmware" pointer is allocated by the strdup() in get_string() function.
The free(firmware) is necessary, and it prevents memory leak.
>
> <snip>
>
> > struct pmd_params {
> > - const char *name;
> > - const char *firmware;
> > + char name[RTE_DEV_NAME_MAX_LEN];
>
> Please replace " RTE_DEV_NAME_MAX_LEN " with "NAME_SIZE" which is
> already defined in softnic_internals.h
It will be modified in the next version.
>
> > + char firmware[PATH_MAX];
>
> Also, instead of using PATH_MAX, define new macro "SOFTNIC_PATH_MAX
> 4096" in softnic_internals.h
It will be modified in the next version.
>
>
> > uint16_t conn_port;
> > uint32_t cpu_id;
> > int sc; /**< Service cores. */
> > --
> > 2.27.0
next prev parent reply other threads:[~2021-07-15 1:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-08 8:44 [dpdk-dev] [PATCH] " dapengx.yu
2021-07-13 8:44 ` Andrew Rybchenko
2021-07-13 10:08 ` [dpdk-dev] [PATCH v2] " dapengx.yu
2021-07-13 10:10 ` Andrew Rybchenko
[not found] ` <PH0PR11MB512563E3EA51977861DF77CF8C149@PH0PR11MB5125.namprd11.prod.outlook.com>
2021-07-13 10:29 ` Andrew Rybchenko
2021-07-14 5:47 ` [dpdk-dev] [PATCH v3] " dapengx.yu
2021-07-14 11:07 ` Singh, Jasvinder
2021-07-15 1:42 ` Yu, DapengX [this message]
2021-07-15 5:38 ` [dpdk-dev] [PATCH v4] " dapengx.yu
2021-07-16 12:04 ` Singh, Jasvinder
2021-07-23 8:11 ` Thomas Monjalon
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=PH0PR11MB512556FCE643F6C97CC3C1378C129@PH0PR11MB5125.namprd11.prod.outlook.com \
--to=dapengx.yu@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=jasvinder.singh@intel.com \
--cc=stable@dpdk.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).