diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-07-20 14:53:57 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-08-26 17:15:28 +0200 |
commit | aa6f7448ebef35249374508c503f53a8859d8a1e (patch) | |
tree | a8dd7b9577656f5427effa5db0b14b8f0a714a17 /hw/scsi | |
parent | 96ac9719331c0fd6e928b340f850b8cb617a3cea (diff) | |
download | qemu-aa6f7448ebef35249374508c503f53a8859d8a1e.zip qemu-aa6f7448ebef35249374508c503f53a8859d8a1e.tar.gz qemu-aa6f7448ebef35249374508c503f53a8859d8a1e.tar.bz2 |
vhost-scsi: Plug memory leak on migrate_add_blocker() failure
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-6-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/vhost-scsi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 8c611bf..039caf2 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -208,7 +208,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) "target SCSI device state or use shared storage over network), " "set 'migratable' property to true to enable migration."); if (migrate_add_blocker(vsc->migration_blocker, errp) < 0) { - error_free(vsc->migration_blocker); goto free_virtio; } } @@ -233,11 +232,12 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) return; free_vqs: + g_free(vsc->dev.vqs); if (!vsc->migratable) { migrate_del_blocker(vsc->migration_blocker); } - g_free(vsc->dev.vqs); free_virtio: + error_free(vsc->migration_blocker); virtio_scsi_common_unrealize(dev); close_fd: close(vhostfd); |