net/softnic: fix memory leak
PATCH 1/1 net/softnic: fix memory leak
When sending request messages to data plane thread, the caller must free the memory allocated to request message on receiving error response.
Coverity Issue: 357717, 357772
--- drivers/net/softnic/rte_eth_softnic_thread.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/softnic/rte_eth_softnic_thread.c +8 -4
@@ -255,9 +255,9 @@ thread_msg_alloc(void) }static void -thread_msg_free (struct thread_msg_rsp *rsp) +thread_msg_free (void *msg) { -free (rsp); +free (msg); } static struct thread_msg_rsp *
@@ -359,8 +359,10 @@ softnic_thread_pipeline_enable(struct pmd_internals *softnic,/* Send request and wait for response */ rsp =thread_msg_send_recv (softnic, thread_id, req); -if (rsp ==NULL ) +if (rsp ==NULL ) { +thread_msg_free (req);return -1 ; + }/* Read response */ status = rsp->status;
@@ -444,8 +446,10 @@ softnic_thread_pipeline_disable(struct pmd_internals *softnic,/* Send request and wait for response */ rsp =thread_msg_send_recv (softnic, thread_id, req); -if (rsp ==NULL ) +if (rsp ==NULL ) { +thread_msg_free (req);return -1 ; + }/* Read response */ status = rsp->status;
Signature · 1 line
2.21.1
PATCH v2 1/1 net/softnic: fix memory leak for thread
For sending request messages to data plane threads, the caller invokes thread_msg_send_recv() function which never returns null response. Thus, removed redundant check on the returned response.
Coverity Issue: 357717, 357772
---
v2:
- change commit message
drivers/net/softnic/rte_eth_softnic_thread.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/softnic/rte_eth_softnic_thread.c +0 -4
@@ -359,8 +359,6 @@ softnic_thread_pipeline_enable(struct pmd_internals *softnic,/* Send request and wait for response */ rsp =thread_msg_send_recv (softnic, thread_id, req); -if (rsp ==NULL ) -return -1 ;/* Read response */ status = rsp->status;
@@ -444,8 +442,6 @@ softnic_thread_pipeline_disable(struct pmd_internals *softnic,/* Send request and wait for response */ rsp =thread_msg_send_recv (softnic, thread_id, req); -if (rsp ==NULL ) -return -1 ;/* Read response */ status = rsp->status;
Signature · 1 line
2.21.1
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH v2] net/softnic: fix memory leak for thread
Quoted 10 lines · Jasvinder Singh
For sending request messages to data plane threads, the caller invokes
thread_msg_send_recv()function which never returns null response. Thus, removed redundant check on the returned response.Coverity Issue: 357717, 357772
Fixes 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")Signed-off-by Jasvinder Singh <[email protected]>
Applied to dpdk-next-net/master, thanks.