aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJie Wang <wangjie88@huawei.com>2019-04-30 15:15:00 +0800
committerMichael S. Tsirkin <mst@redhat.com>2019-05-29 18:00:57 -0400
commit386cff49ebd1748b0319c88e5282236f9e56b81b (patch)
tree94fcd20379af3bf35b9bad3ec354bccc3fe343e7 /hw
parent31618958cc48d8c51e7e256285b467c1c56af3b9 (diff)
downloadqemu-386cff49ebd1748b0319c88e5282236f9e56b81b.zip
qemu-386cff49ebd1748b0319c88e5282236f9e56b81b.tar.gz
qemu-386cff49ebd1748b0319c88e5282236f9e56b81b.tar.bz2
vhost: fix memory leak in vhost_user_scsi_realize
fix memory leak in vhost_user_scsi_realize Signed-off-by: Jie Wang <wangjie88@huawei.com> Message-Id: <1556608500-12183-1-git-send-email-wangjie88@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/scsi/vhost-user-scsi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index 8b1e687..a9fd8ea 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -69,6 +69,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
VHostUserSCSI *s = VHOST_USER_SCSI(dev);
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
+ struct vhost_virtqueue *vqs = NULL;
Error *err = NULL;
int ret;
@@ -93,6 +94,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)
vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs);
vsc->dev.vq_index = 0;
vsc->dev.backend_features = 0;
+ vqs = vsc->dev.vqs;
ret = vhost_dev_init(&vsc->dev, &s->vhost_user,
VHOST_BACKEND_TYPE_USER, 0);
@@ -100,6 +102,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)
error_setg(errp, "vhost-user-scsi: vhost initialization failed: %s",
strerror(-ret));
vhost_user_cleanup(&s->vhost_user);
+ g_free(vqs);
return;
}