patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: "Singh, Aman Deep" <aman.deep.singh@intel.com>,
	"Morrissey, Sean" <sean.morrissey@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Zhang, Yuying" <yuying.zhang@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH] app/testpmd: fix memory leak for dscp table
Date: Wed, 29 Jun 2022 17:24:16 +0000	[thread overview]
Message-ID: <CY4PR11MB15890D825DE19EBB8FB2DAFCE0BB9@CY4PR11MB1589.namprd11.prod.outlook.com> (raw)
In-Reply-To: <46bc5dbf-dfc1-b042-a249-a644af61223f@intel.com>



> -----Original Message-----
> From: Singh, Aman Deep <aman.deep.singh@intel.com>
> Sent: Wednesday, June 29, 2022 5:53 PM
> To: Morrissey, Sean <sean.morrissey@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; dev@dpdk.org
> Cc: Zhang, Yuying <yuying.zhang@intel.com>; stable@dpdk.org
> Subject: Re: [PATCH] app/testpmd: fix memory leak for dscp table
> 
> Hi Jasvinder,
> 
> Thanks for the patch.
> 
> 
> On 6/29/2022 9:07 PM, Morrissey, Sean wrote:
> > Reviewed-by: Sean Morrissey <sean.morrissey@intel.com>
> >
> > Thanks.
> >
> > On 28/06/2022 14:29, Jasvinder Singh wrote:
> >> This patch fixes memory leak reported by coverity.
> >>
> >> Coverity issue: 379220
> >> Fixes: 9f5488e326d3 ("app/testpmd: support different input color
> >> method")
> >>
> >> Cc: stable@dpdk.org
> >>
> >> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> >> ---
> >>   app/test-pmd/cmdline_mtr.c | 6 +++++-
> >>   1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
> >> index b92e66cedb..833273da0d 100644
> >> --- a/app/test-pmd/cmdline_mtr.c
> >> +++ b/app/test-pmd/cmdline_mtr.c
> >> @@ -131,8 +131,10 @@ parse_input_color_table_entries(char *str, enum
> >> rte_color **dscp_table,
> >>       /* Allocate memory for vlan table */
> >>       vlan = (enum rte_color *)malloc(MAX_VLAN_TABLE_ENTRIES *
> >>           sizeof(enum rte_color));
> >> -    if (vlan == NULL)
> >> +    if (vlan == NULL) {
> >> +        free(*dscp_table);
> >>           return -1;
> >> +    }
> 
> Did we miss one return at line 129, or is it not required-
> 
> 	token = strtok_r(str, PARSE_DELIMITER, &str);
> 	if (token == NULL)
> 		return 0;
> 
No need to free the allocated memory on successful return from the function.  

  reply	other threads:[~2022-06-29 17:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 13:29 Jasvinder Singh
2022-06-29 15:37 ` Morrissey, Sean
2022-06-29 16:53   ` Singh, Aman Deep
2022-06-29 17:24     ` Singh, Jasvinder [this message]
2022-06-29 17:30 ` Singh, Aman Deep
2022-07-06 14:32   ` Andrew Rybchenko
2022-07-07 12:39     ` Andrew Rybchenko

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=CY4PR11MB15890D825DE19EBB8FB2DAFCE0BB9@CY4PR11MB1589.namprd11.prod.outlook.com \
    --to=jasvinder.singh@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=sean.morrissey@intel.com \
    --cc=stable@dpdk.org \
    --cc=yuying.zhang@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).