virtio-input: fix memory leak on unrealize
Spotted by ASAN + minor stylistic change. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20191121095649.25453-1-marcandre.lureau@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
2061735ff0
commit
509ec36c1e
@ -275,6 +275,7 @@ static void virtio_input_finalize(Object *obj)
|
|||||||
|
|
||||||
g_free(vinput->queue);
|
g_free(vinput->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
|
static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
|
VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
|
||||||
@ -288,6 +289,8 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtio_del_queue(vdev, 0);
|
||||||
|
virtio_del_queue(vdev, 1);
|
||||||
virtio_cleanup(vdev);
|
virtio_cleanup(vdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user