mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
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>
This commit is contained in:
parent
31618958cc
commit
386cff49eb
1 changed files with 3 additions and 0 deletions
|
@ -69,6 +69,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)
|
||||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
|
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
|
||||||
VHostUserSCSI *s = VHOST_USER_SCSI(dev);
|
VHostUserSCSI *s = VHOST_USER_SCSI(dev);
|
||||||
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
|
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
|
||||||
|
struct vhost_virtqueue *vqs = NULL;
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
int ret;
|
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.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs);
|
||||||
vsc->dev.vq_index = 0;
|
vsc->dev.vq_index = 0;
|
||||||
vsc->dev.backend_features = 0;
|
vsc->dev.backend_features = 0;
|
||||||
|
vqs = vsc->dev.vqs;
|
||||||
|
|
||||||
ret = vhost_dev_init(&vsc->dev, &s->vhost_user,
|
ret = vhost_dev_init(&vsc->dev, &s->vhost_user,
|
||||||
VHOST_BACKEND_TYPE_USER, 0);
|
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",
|
error_setg(errp, "vhost-user-scsi: vhost initialization failed: %s",
|
||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
vhost_user_cleanup(&s->vhost_user);
|
vhost_user_cleanup(&s->vhost_user);
|
||||||
|
g_free(vqs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue