diff options
-rw-r--r-- | hw/virtio-scsi.c | 7 | ||||
-rw-r--r-- | hw/virtio-scsi.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c index 55191c566c..08fcb80b1b 100644 --- a/hw/virtio-scsi.c +++ b/hw/virtio-scsi.c @@ -690,12 +690,12 @@ VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf) { VirtIOSCSI *s; static int virtio_scsi_id; - size_t sz; int i; - sz = sizeof(VirtIOSCSI) + proxyconf->num_queues * sizeof(VirtQueue *); s = (VirtIOSCSI *)virtio_common_init("virtio-scsi", VIRTIO_ID_SCSI, - sizeof(VirtIOSCSIConfig), sz); + sizeof(VirtIOSCSIConfig), + sizeof(VirtIOSCSI)); + s->cmd_vqs = g_malloc0(proxyconf->num_queues * sizeof(VirtQueue *)); s->qdev = dev; s->conf = *proxyconf; @@ -730,5 +730,6 @@ void virtio_scsi_exit(VirtIODevice *vdev) { VirtIOSCSI *s = (VirtIOSCSI *)vdev; unregister_savevm(s->qdev, "virtio-scsi", s); + g_free(s->cmd_vqs); virtio_cleanup(vdev); } diff --git a/hw/virtio-scsi.h b/hw/virtio-scsi.h index 6a0a95e07b..fb83b67cf7 100644 --- a/hw/virtio-scsi.h +++ b/hw/virtio-scsi.h @@ -44,7 +44,7 @@ typedef struct VirtIOSCSI { bool events_dropped; VirtQueue *ctrl_vq; VirtQueue *event_vq; - VirtQueue *cmd_vqs[0]; + VirtQueue **cmd_vqs; } VirtIOSCSI; #define DEFINE_VIRTIO_SCSI_PROPERTIES(_state, _features_field, _conf_field) \ |