app/testpmd: fix memory leak on detach
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 20 Nov 2019 23:26:28 +0000 (15:26 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 26 Nov 2019 17:05:15 +0000 (18:05 +0100)
The RTE_FOREACH_MATCHING_DEV iterator requires that
if a break is done before the end of the loop,
the function rte_eth_iterator_cleanup() must be called.

Fixes: 55e51c962432 ("app/testpmd: add device related commands")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
app/test-pmd/testpmd.c

index 73ebf37..ac1b7b6 100644 (file)
@@ -2619,6 +2619,7 @@ detach_device(char *identifier)
                if (ports[port_id].port_status != RTE_PORT_CLOSED) {
                        if (ports[port_id].port_status != RTE_PORT_STOPPED) {
                                printf("Port %u not stopped\n", port_id);
+                               rte_eth_iterator_cleanup(&iterator);
                                return;
                        }