[v2] test-pmd: fix memory leaks when mtr policer actions update fails

Message ID 1590371183-22636-1-git-send-email-wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] test-pmd: fix memory leaks when mtr policer actions update fails |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-testing fail Testing issues
ci/Intel-compilation success Compilation OK

Commit Message

Yunjian Wang May 25, 2020, 1:46 a.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

This patch fixes the Huawei internal coverity reported
resource leak issue.

Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
v2:
 * Update commit log
---
 app/test-pmd/cmdline_mtr.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon May 25, 2020, 6:51 a.m. UTC | #1
25/05/2020 03:46, wangyunjian:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> This patch fixes the Huawei internal coverity reported
> resource leak issue.

The problem is not seen in the community Coverity?


> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> v2:
>  * Update commit log

Please, next time, use --in-reply-to to keep v1 and v2 in the same thread.
  
Yunjian Wang May 26, 2020, 2:04 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Monday, May 25, 2020 2:51 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Lilijun (Jerry) <jerry.lilijun@huawei.com>;
> xudingke <xudingke@huawei.com>; wangyunjian <wangyunjian@huawei.com>;
> stable@dpdk.org; cristian.dumitrescu@intel.com
> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] test-pmd: fix memory leaks
> when mtr policer actions update fails
> 
> 25/05/2020 03:46, wangyunjian:
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > This patch fixes the Huawei internal coverity reported resource leak
> > issue.
> 
> The problem is not seen in the community Coverity?

I don't know much about that.

> 
> 
> > Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing
> > commands")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > ---
> > v2:
> >  * Update commit log
> 
> Please, next time, use --in-reply-to to keep v1 and v2 in the same thread.

OK, thanks.

>
  
Thomas Monjalon May 26, 2020, 7:13 a.m. UTC | #3
26/05/2020 04:04, wangyunjian:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 25/05/2020 03:46, wangyunjian:
> > > From: Yunjian Wang <wangyunjian@huawei.com>
> > >
> > > This patch fixes the Huawei internal coverity reported resource leak
> > > issue.
> > 
> > The problem is not seen in the community Coverity?
> 
> I don't know much about that.

Please, could you register and check here?
https://scan.coverity.com/projects/dpdk-data-plane-development-kit
  
Yunjian Wang May 27, 2020, 2:10 a.m. UTC | #4
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday, May 26, 2020 3:14 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Lilijun (Jerry) <jerry.lilijun@huawei.com>;
> xudingke <xudingke@huawei.com>; cristian.dumitrescu@intel.com;
> john.mcnamara@intel.com
> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] test-pmd: fix memory leaks
> when mtr policer actions update fails
> 
> 26/05/2020 04:04, wangyunjian:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 25/05/2020 03:46, wangyunjian:
> > > > From: Yunjian Wang <wangyunjian@huawei.com>
> > > >
> > > > This patch fixes the Huawei internal coverity reported resource
> > > > leak issue.
> > >
> > > The problem is not seen in the community Coverity?
> >
> > I don't know much about that.
> 
> Please, could you register and check here?
> https://scan.coverity.com/projects/dpdk-data-plane-development-kit

OK, I have registered, but I do not find this issue in it.
Thanks,
Yunjian

> 
>
  
Thomas Monjalon May 27, 2020, 8:05 a.m. UTC | #5
27/05/2020 04:10, wangyunjian:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 26/05/2020 04:04, wangyunjian:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > 25/05/2020 03:46, wangyunjian:
> > > > > From: Yunjian Wang <wangyunjian@huawei.com>
> > > > >
> > > > > This patch fixes the Huawei internal coverity reported resource
> > > > > leak issue.
> > > >
> > > > The problem is not seen in the community Coverity?
> > >
> > > I don't know much about that.
> > 
> > Please, could you register and check here?
> > https://scan.coverity.com/projects/dpdk-data-plane-development-kit
> 
> OK, I have registered, but I do not find this issue in it.

Thanks for having check.
  
Ferruh Yigit May 27, 2020, 10:57 p.m. UTC | #6
On 5/25/2020 2:46 AM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> This patch fixes the Huawei internal coverity reported
> resource leak issue.
> 
> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Updating commit log as following:

"
    app/testpmd: fix memory leaks on error path

    This patch fixes the resource leak issue.

    Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
    Cc: stable@dpdk.org
"

1) Updated patch title
2) Removed reference to internal coverity, since others can't access it, this
information doesn't add value


Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index caa7e9864..ee16244de 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -1262,6 +1262,7 @@  static void cmd_set_port_meter_policer_action_parsed(void *parsed_result,
 	ret = rte_mtr_policer_actions_update(port_id, mtr_id,
 		action_mask, actions, &error);
 	if (ret != 0) {
+		free(actions);
 		print_err_msg(&error);
 		return;
 	}