From ed4b43265d4d0c7ecfbbcb4001f61700756f22b9 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Tue, 11 Nov 2014 09:17:09 +0800 Subject: [PATCH] virtio-scsi: dataplane: fix allocation for 'cmd_vrings' The size of each element should be sizeof(VirtIOSCSIVring *). Signed-off-by: Ming Lei Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini --- hw/scsi/virtio-scsi-dataplane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index 9651e6f274..969b931557 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -230,7 +230,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s) if (!s->event_vring) { goto fail_vrings; } - s->cmd_vrings = g_malloc0(sizeof(VirtIOSCSIVring) * vs->conf.num_queues); + s->cmd_vrings = g_new(VirtIOSCSIVring *, vs->conf.num_queues); for (i = 0; i < vs->conf.num_queues; i++) { s->cmd_vrings[i] = virtio_scsi_vring_init(s, vs->cmd_vqs[i],