app/testpmd: fix action destruction memory leak
PATCH 1/1 app/testpmd: fix action destruction memory leak
In case action handle destroy fails, the job memory was not freed properly. This commit fixes the possible memory leak in the action handle destruction failed case.
--- app/test-pmd/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/config.c +2 -2
@@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t port_id, job->type =QUEUE_JOB_TYPE_ACTION_DESTROY ; job->pia = pia; -if (pia->handle && -rte_flow_async_action_handle_destroy (port_id, +if (rte_flow_async_action_handle_destroy (port_id, queue_id, &attr, pia->handle, job, &error)) { +free (job); ret =port_flow_complain (&error);continue ; }
Signature · 1 line
2.25.1
Quoted 7 lines · Suanming Mou
In case action handle destroy fails, the job memory was not freed properly. This commit fixes the possible memory leak in the action handle destruction failed case.
Fixes c9dc03840873 ("ethdev: add indirect action async query")
Quoted 1 line
Signed-off-by Suanming Mou <[email protected]>
LGTM.
Thanks.
Signature · 1 line
David Marchand
Quoted 16 lines · Suanming Mou
In case action handle destroy fails, the job memory was not freed properly. This commit fixes the possible memory leak in the action handle destruction failed case.
Fixes c9dc03840873 ("ethdev: add indirect action async query")Signed-off-by Suanming Mou <[email protected]>--- app/test-pmd/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)app/test-pmd/config.c +0
-0
app/test-pmd/config.c port_queue_action_handle_destroy(portid_t port_id, · line 2876
Quoted 6 lines
app/test-pmd/config.c +1
-2@@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t port_id, job->type =QUEUE_JOB_TYPE_ACTION_DESTROY ; job->pia = pia; -if (pia->handle && - rte_flow_async_action_handle_destroy(port_id, + if (rte_flow_async_action_handle_destroy(port_id,
Why 'pia->handle' check removed, was it unnecessary to check it at first place?
app/test-pmd/config.c port_queue_action_handle_destroy(portid_t port_id, · line 2881
Quoted 5 lines
app/test-pmd/config.c +1
-0queue_id, &attr, pia->handle, job, &error)) { +free (job); ret =port_flow_complain (&error);continue ; }
Just to double check, when this if branch not taken, 'rte_flow_async_action_handle_destroy()' not failed case, testpmd 'port_queue_flow_pull()' functions frees the 'job', right?
Hi,
Quoted 36 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, November 18, 2022 6:40 PM
To: Suanming Mou <[email protected]>; [email protected]; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] app/testpmd: fix action destruction memory leakapp/test-pmd/config.c port_queue_action_handle_destroy(portid_t
Quoted 16 lines · Suanming Mou
In case action handle destroy fails, the job memory was not freed properly. This commit fixes the possible memory leak in the action handle destruction failed case.
Fixes c9dc03840873 ("ethdev: add indirect action async query")Signed-off-by Suanming Mou <[email protected]>--- app/test-pmd/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
982549ffed..719bdd4261100644app/test-pmd/config.c +0
-0@@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t
port_id,app/test-pmd/config.c port_queue_action_handle_destroy(portid_t port_id, · line 2876
Quoted 6 lines
app/test-pmd/config.c +1
-2job->type =QUEUE_JOB_TYPE_ACTION_DESTROY ; job->pia = pia; -if (pia->handle && - rte_flow_async_action_handle_destroy(port_id, + if (rte_flow_async_action_handle_destroy(port_id,Why '
pia->handle' check removed, was it unnecessary to check it at first place?
Quoted 9 lines
app/test-pmd/config.c port_queue_action_handle_destroy(portid_t port_id, · line 2881
Quoted 5 lines
app/test-pmd/config.c +1
-0queue_id, &attr, pia->handle, job, &error)) { +free (job); ret =port_flow_complain (&error);continue ; }Just to double check, when this if branch not taken, '
rte_flow_async_action_handle_destroy()' not failed case, testpmd 'port_queue_flow_pull()' functions frees the 'job', right?
Yes, port_queue_flow_pull() will free the 'job'.
Ferruh Yigit
AppliedQuoted 37 lines · Suanming Mou
Hi,
Quoted 35 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, November 18, 2022 6:40 PM
To: Suanming Mou <[email protected]>; [email protected]; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] app/testpmd: fix action destruction memory leakapp/test-pmd/config.c port_queue_action_handle_destroy(portid_t
Quoted 16 lines · Suanming Mou
In case action handle destroy fails, the job memory was not freed properly. This commit fixes the possible memory leak in the action handle destruction failed case.
Fixes c9dc03840873 ("ethdev: add indirect action async query")Signed-off-by Suanming Mou <[email protected]>--- app/test-pmd/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)app/test-pmd/config.c index renamed from app/test-pmd/config.c +0
-0
982549ffed..719bdd4261100644app/test-pmd/config.c +0
-0@@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t
port_id,app/test-pmd/config.c port_queue_action_handle_destroy(portid_t port_id, · line 2876
Quoted 6 lines
app/test-pmd/config.c +1
-2job->type =QUEUE_JOB_TYPE_ACTION_DESTROY ; job->pia = pia; -if (pia->handle && - rte_flow_async_action_handle_destroy(port_id, + if (rte_flow_async_action_handle_destroy(port_id,Why '
pia->handle' check removed, was it unnecessary to check it at first place?
This seems already discussed and agreed in other thread, so proceeding.
Applied to dpdk-next-net/main, thanks.