From: Fam Zheng Date: Thu, 30 Oct 2014 11:50:26 +0000 (+0800) Subject: virtio-scsi: Fix memory leak when realize failed X-Git-Tag: qemu-xen-4.6.0-rc1~102^2~14 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=93bd49aff9081bbe9440192db9da3676941f77a3;p=qemu-upstream-unstable.git virtio-scsi: Fix memory leak when realize failed Signed-off-by: Fam Zheng Signed-off-by: Paolo Bonzini --- diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 7d40eccb0..235c2053d 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -808,6 +808,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp, error_setg(errp, "Invalid number of queues (= %" PRId32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); + virtio_cleanup(vdev); return; } s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));