hw/scsi/vhost-scsi: don't leak vqs on error
commitb259772afc29ef6af4e911d8e695dd7e2ed31066
authorDaniil Tatianin <d-tatianin@yandex-team.ru>
Mon, 29 Nov 2021 13:23:57 +0000 (29 16:23 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Sat, 8 Jan 2022 00:30:13 +0000 (7 19:30 -0500)
tree455bd86eac705929b2aba44a73a6c89a871f248e
parent14dc58e3e0b12595e407502b93a8bb7e69621cbb
hw/scsi/vhost-scsi: don't leak vqs on error

vhost_dev_init calls vhost_dev_cleanup in case of an error during
initialization, which zeroes out the entire vsc->dev as well as the
vsc->dev.vqs pointer. This prevents us from properly freeing it in free_vqs.
Keep a local copy of the pointer so we can free it later.

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Message-Id: <20211129132358.1110372-1-d-tatianin@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/scsi/vhost-scsi.c