patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/softnic: fix memory leak in connection init
@ 2021-07-09  6:00 dapengx.yu
  2021-07-13  9:37 ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
  0 siblings, 1 reply; 2+ messages in thread
From: dapengx.yu @ 2021-07-09  6:00 UTC (permalink / raw)
  To: Jasvinder Singh, Cristian Dumitrescu; +Cc: dev, Dapeng Yu, stable

From: Dapeng Yu <dapengx.yu@intel.com>

In function softnic_conn_init(), a block of memory is allocated as
connection buffer, but it is never freed in softnic_conn_free(),
which cause memory leak.

This patch fixes it.

Fixes: 7709a63bf178 ("net/softnic: add connection agent")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
 drivers/net/softnic/conn.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/softnic/conn.c b/drivers/net/softnic/conn.c
index 8b66580887..a9548beac7 100644
--- a/drivers/net/softnic/conn.c
+++ b/drivers/net/softnic/conn.c
@@ -146,6 +146,7 @@ softnic_conn_free(struct softnic_conn *conn)
 	free(conn->msg_in);
 	free(conn->prompt);
 	free(conn->welcome);
+	free(conn->buf);
 	free(conn);
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/softnic: fix memory leak in connection init
  2021-07-09  6:00 [dpdk-stable] [PATCH] net/softnic: fix memory leak in connection init dapengx.yu
@ 2021-07-13  9:37 ` Andrew Rybchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Rybchenko @ 2021-07-13  9:37 UTC (permalink / raw)
  To: dapengx.yu, Jasvinder Singh, Cristian Dumitrescu; +Cc: dev, stable

On 7/9/21 9:00 AM, dapengx.yu@intel.com wrote:
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> In function softnic_conn_init(), a block of memory is allocated as
> connection buffer, but it is never freed in softnic_conn_free(),
> which cause memory leak.
> 
> This patch fixes it.
> 
> Fixes: 7709a63bf178 ("net/softnic: add connection agent")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> ---
>  drivers/net/softnic/conn.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/softnic/conn.c b/drivers/net/softnic/conn.c
> index 8b66580887..a9548beac7 100644
> --- a/drivers/net/softnic/conn.c
> +++ b/drivers/net/softnic/conn.c
> @@ -146,6 +146,7 @@ softnic_conn_free(struct softnic_conn *conn)
>  	free(conn->msg_in);
>  	free(conn->prompt);
>  	free(conn->welcome);
> +	free(conn->buf);
>  	free(conn);
>  }
>  
> 

Fixed order to free in reverse order vs fields in the structure
and allocation.

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-13  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09  6:00 [dpdk-stable] [PATCH] net/softnic: fix memory leak in connection init dapengx.yu
2021-07-13  9:37 ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).