net/softnic: fix memory leak in connection init
PATCH 1/1 net/softnic: fix memory leak in connection init
From: Dapeng Yu <[email protected]>
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")
Signed-off-by Dapeng Yu <[email protected]>
--- drivers/net/softnic/conn.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/softnic/conn.c +1 -0
@@ -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); }
Signature · 1 line
2.27.0
Quoted 22 lines · On 7/9/21 9:00 AM, [email protected] wrote:
From: Dapeng Yu <[email protected]>
In function
softnic_conn_init(), a block of memory is allocated as connection buffer, but it is never freed insoftnic_conn_free(), which cause memory leak.This patch fixes it.
Fixes 7709a63bf178 ("net/softnic: add connection agent")Signed-off-by Dapeng Yu <[email protected]>--- drivers/net/softnic/conn.c | 1 + 1 file changed, 1 insertion(+)drivers/net/softnic/conn.c +0
-0
drivers/net/softnic/conn.c softnic_conn_free(struct softnic_conn *conn) · line 152
Quoted 7 lines
drivers/net/softnic/conn.c +1
-0@@ -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 <[email protected]>
Applied, thanks.