[dpdk-dev] [PATCH] net/softnic: fix memory leak in connection init

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Tue Jul 13 11:37:34 CEST 2021


On 7/9/21 9:00 AM, dapengx.yu at intel.com wrote:
> From: Dapeng Yu <dapengx.yu at 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 at dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu at 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 at oktetlabs.ru>

Applied, thanks.



More information about the dev mailing list