app/testpmd: fix memory leak for DSCP table
authorJasvinder Singh <jasvinder.singh@intel.com>
Wed, 14 Nov 2018 11:58:59 +0000 (11:58 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 18 Nov 2018 21:32:47 +0000 (22:32 +0100)
Fix memory leak for dscp table reported by coverity

Coverity issue: 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

index 846de88..c506d87 100644 (file)
@@ -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);
 }