From: Michael S. Tsirkin Date: Mon, 9 Dec 2019 16:47:24 +0000 (-0500) Subject: virtio: make virtio_delete_queue idempotent X-Git-Tag: v4.2.1~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a843731d7f09ca102833a06adaf358abb524a86b;p=thirdparty%2Fqemu.git 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 Signed-off-by: Michael S. Tsirkin (cherry picked from commit 8cd353ea0fbf0e334e015d833f612799be642296) *prereq for 421afd2fe8 Signed-off-by: Michael Roth --- diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 31dd140990f..6de3cfdc2c9 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)