[PATCH 1/4] vhost: fix resource leak
Maxime Coquelin
maxime.coquelin at redhat.com
Tue Mar 17 15:46:58 CET 2026
Hi Kevin,
On Thu, Mar 12, 2026 at 11:36 AM Kevin Traynor <ktraynor at redhat.com> wrote:
>
> When the return value check for pthread_mutex_init() was removed the
> out_free label and vhost_user_socket_mem_free() were removed.
>
> The free is still needed as vsocket was not being freed on out_mutex
> error path.
>
> Restore vhost_user_socket_mem_free() on error path.
>
> Fixes: 4d2aa150769b ("vhost: remove check around mutex init")
> Cc: stable at dpdk.org
>
> Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
> ---
> lib/vhost/socket.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index ae95e7e6b0..278a2c01d8 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -1037,4 +1037,5 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
> VHOST_CONFIG_LOG(path, ERR, "failed to destroy connection mutex");
> }
> + vhost_user_socket_mem_free(vsocket);
> out:
> pthread_mutex_unlock(&vhost_user.mutex);
> --
> 2.53.0
>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Thanks,
Maxime
More information about the dev
mailing list