Skip to content

Commit

Permalink
virtio: make virtio_delete_queue idempotent
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mstsirkin committed Jan 5, 2020
1 parent 722f8c5 commit 8cd353e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/virtio/virtio.c
Expand Up @@ -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)
Expand Down

0 comments on commit 8cd353e

Please sign in to comment.