virtio: make virtio_delete_queue idempotent

Let's make sure calling this twice is harmless -
no known instances, but seems safer.

Suggested-by: Pan Nengyuan <pannengyuan@huawei.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Michael S. Tsirkin 2019-12-09 11:47:24 -05:00
parent 722f8c51d8
commit 8cd353ea0f
1 changed files with 1 additions and 0 deletions

View File

@ -2337,6 +2337,7 @@ void virtio_delete_queue(VirtQueue *vq)
vq->handle_output = NULL;
vq->handle_aio_output = NULL;
g_free(vq->used_elems);
vq->used_elems = NULL;
}
void virtio_del_queue(VirtIODevice *vdev, int n)