diff mbox series

testpmd: fix memory leak for dscp table

Message ID 20181114115859.160722-1-jasvinder.singh@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series testpmd: fix memory leak for dscp table | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Singh, Jasvinder Nov. 14, 2018, 11:58 a.m. UTC
Fix memory leak for dscp table reported by coverity

Coverity ID: 326961
Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
CC: stable@dpdk.org

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 app/test-pmd/cmdline_mtr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Monjalon Nov. 18, 2018, 8:36 p.m. UTC | #1
14/11/2018 12:58, Jasvinder Singh:
> Fix memory leak for dscp table reported by coverity
> 
> Coverity ID: 326961
> Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
> CC: stable@dpdk.org
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>

Applied, thanks
diff mbox series

Patch

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 846de88db..c506d87ee 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -1148,15 +1148,15 @@  static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
 	}
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return;
+		goto free_table;
 
 	/* Update Meter DSCP Table*/
 	ret = rte_mtr_meter_dscp_table_update(port_id, mtr_id,
 		dscp_table, &error);
-	if (ret != 0) {
+	if (ret != 0)
 		print_err_msg(&error);
-		return;
-	}
+
+free_table:
 	free(dscp_table);
 }