From: Shani Peretz <[email protected]>

When a port is closed via close_port(), port_free_job_list() frees the
job_list but does not NULL the pointer or reset queue_nb. If the port
is later reattached and "flow configure" is issued, port_flow_configure()
frees the dangling job_list pointer, causing a double-free.

Fix this by setting job_list to NULL and resetting queue_nb to zero in
port_free_job_list() after freeing.

Fixes: 7fadc8039588 ("app/testpmd: fix memory leak in port flow configure")
Cc: [email protected]

Signed-off-by: Shani Peretz <[email protected]>
Acked-by: Dariusz Sosnowski <[email protected]>
---
 app/test-pmd/testpmd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 9a85657840a..ef337a4d144 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3358,6 +3358,8 @@ port_free_job_list(portid_t pi)
 {
        struct rte_port *port = &ports[pi];
        free(port->job_list);
+       port->job_list = NULL;
+       port->queue_nb = 0;
 }
 
 static void
-- 
2.21.0

Reply via email to