aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-10-30 19:50:26 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-10-31 11:29:02 +0100
commit93bd49aff9081bbe9440192db9da3676941f77a3 (patch)
tree4b4bff310170efd3f99dd7baaccfe24f1a160bec /hw/scsi
parentc1d4096b0f033d0a52c542f0948403783c3682e9 (diff)
virtio-scsi: Fix memory leak when realize failed
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/virtio-scsi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 7d40eccb0c..235c2053da 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 *));