aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorTing Wang <kathy.wangting@huawei.com>2015-03-26 15:42:32 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2015-03-26 14:23:16 +0100
commit4020db0475b3e527b3bdc97dff873c2be9da2698 (patch)
treefc793685555c20e9ac4d9aca5ba1cd56ef6242eb /hw/scsi
parentfe75270cb619549b2aa1ba59bd202faf306204a1 (diff)
downloadqemu-4020db0475b3e527b3bdc97dff873c2be9da2698.zip
qemu-4020db0475b3e527b3bdc97dff873c2be9da2698.tar.gz
qemu-4020db0475b3e527b3bdc97dff873c2be9da2698.tar.bz2
virtio-scsi-dataplane: fix memory leak for VirtIOSCSIVring
VirtIOSCSIVring which allocated in virtio_scsi_vring_init should be free when dataplane has been stopped or failed to start. Signed-off-by: Ting Wang <kathy.wangting@huawei.com> Message-Id: <1427355752-25844-1-git-send-email-kathy.wangting@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/virtio-scsi-dataplane.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index c069cd7..5575648 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -182,13 +182,19 @@ static void virtio_scsi_vring_teardown(VirtIOSCSI *s)
if (s->ctrl_vring) {
vring_teardown(&s->ctrl_vring->vring, vdev, 0);
+ g_slice_free(VirtIOSCSIVring, s->ctrl_vring);
+ s->ctrl_vring = NULL;
}
if (s->event_vring) {
vring_teardown(&s->event_vring->vring, vdev, 1);
+ g_slice_free(VirtIOSCSIVring, s->event_vring);
+ s->event_vring = NULL;
}
if (s->cmd_vrings) {
for (i = 0; i < vs->conf.num_queues && s->cmd_vrings[i]; i++) {
vring_teardown(&s->cmd_vrings[i]->vring, vdev, 2 + i);
+ g_slice_free(VirtIOSCSIVring, s->cmd_vrings[i]);
+ s->cmd_vrings[i] = NULL;
}
free(s->cmd_vrings);
s->cmd_vrings = NULL;