diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2019-12-09 11:47:24 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2020-01-05 07:03:03 -0500 |
commit | 8cd353ea0fbf0e334e015d833f612799be642296 (patch) | |
tree | ef864fb7e140ebc8693b77ec07f74c35d01e2303 | |
parent | 722f8c51d8af223751dfb1d02de40043e8ba067e (diff) |
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>
-rw-r--r-- | hw/virtio/virtio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 31dd140990..6de3cfdc2c 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -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) |