On Thu, Nov 05, 2026 at 05:24:43PM +0100, Stefano Garzarella wrote:
From: Stefano Garzarella <[email protected]>

vhost_dev_init() clears the struct vhost_dev in the error path calling
vhost_dev_cleanup(). So, to prevent memory leaks, we need to keep a
local reference to the vhost_virtqueue array and deallocate it in case
of failure, just as most other callers of vhost_dev_init() do.

Discovered while reviewing a patch by Alexandr Moshkov fixing the
same issue in vhost-user-fs.

Fixes: f24bb7287ddb ("Add vhost-user-backend")
Signed-off-by: Stefano Garzarella <[email protected]>
---


Reviewed-by: Luigi Leonardi <[email protected]>

Thanks,
Luigi


Reply via email to