From: Akihiko Odaki Date: Thu, 27 Jun 2024 13:37:50 +0000 (+0900) Subject: hw/virtio: Free vqs after vhost_dev_cleanup() X-Git-Tag: v9.1.0-rc0~46^2~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25b8a0f40c7f408442c5fd4da195fce9997cfb78;p=thirdparty%2Fqemu.git hw/virtio: Free vqs after vhost_dev_cleanup() This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Message-Id: <20240627-san-v2-7-750bb0946dbd@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index 11e72b1e3ba..2bc3423326e 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -223,6 +223,7 @@ static void vub_disconnect(DeviceState *dev) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserBase *vub = VHOST_USER_BASE(vdev); + struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; if (!vub->connected) { goto done; @@ -231,6 +232,7 @@ static void vub_disconnect(DeviceState *dev) vub_stop(vdev); vhost_dev_cleanup(&vub->vhost_dev); + g_free(vhost_vqs); done: /* Re-instate the event handler for new connections */