mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-02 22:41:07 +00:00
vhost-user-fs: Back up vqs before cleaning up vhost_dev
vhost_dev_cleanup() clears vhost_dev so back up its vqs member to free
the memory pointed by the member.
Fixes: 98fc1ada4c
("virtio: add vhost-user-fs base device")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230130140225.77964-1-akihiko.odaki@daynix.com>
This commit is contained in:
parent
417296c8d8
commit
331acddc87
1 changed files with 2 additions and 2 deletions
|
@ -273,6 +273,7 @@ static void vuf_device_unrealize(DeviceState *dev)
|
||||||
{
|
{
|
||||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||||
VHostUserFS *fs = VHOST_USER_FS(dev);
|
VHostUserFS *fs = VHOST_USER_FS(dev);
|
||||||
|
struct vhost_virtqueue *vhost_vqs = fs->vhost_dev.vqs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* This will stop vhost backend if appropriate. */
|
/* This will stop vhost backend if appropriate. */
|
||||||
|
@ -288,8 +289,7 @@ static void vuf_device_unrealize(DeviceState *dev)
|
||||||
}
|
}
|
||||||
g_free(fs->req_vqs);
|
g_free(fs->req_vqs);
|
||||||
virtio_cleanup(vdev);
|
virtio_cleanup(vdev);
|
||||||
g_free(fs->vhost_dev.vqs);
|
g_free(vhost_vqs);
|
||||||
fs->vhost_dev.vqs = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev)
|
static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev)
|
||||||
|
|
Loading…
Reference in a new issue