aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2023-01-30 23:02:25 +0900
committerStefan Hajnoczi <stefanha@redhat.com>2023-02-09 10:21:11 -0500
commit331acddc87b739c64b936ba4e58518f8491f1c6b (patch)
treeea9a81915eaed07ae5574c1cc5a0cd6316758421 /hw/virtio
parent417296c8d8588f782018d01a317f88957e9786d6 (diff)
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>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-user-fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index f5049735ac..83fc20e49e 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -273,6 +273,7 @@ static void vuf_device_unrealize(DeviceState *dev)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostUserFS *fs = VHOST_USER_FS(dev);
+ struct vhost_virtqueue *vhost_vqs = fs->vhost_dev.vqs;
int i;
/* This will stop vhost backend if appropriate. */
@@ -288,8 +289,7 @@ static void vuf_device_unrealize(DeviceState *dev)
}
g_free(fs->req_vqs);
virtio_cleanup(vdev);
- g_free(fs->vhost_dev.vqs);
- fs->vhost_dev.vqs = NULL;
+ g_free(vhost_vqs);
}
static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev)