virtio-net: don't use vdev after virtio_cleanup
virtio_cleanup() will be changed by the following patch to remove the
VirtIONet struct that gets allocated via virtio_common_init(). Ensure
we don't dereference the structure after calling the cleanup function.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 6997e02..09c665b 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -1073,6 +1073,6 @@
qemu_bh_delete(n->tx_bh);
}
- virtio_cleanup(&n->vdev);
qemu_del_vlan_client(&n->nic->nc);
+ virtio_cleanup(&n->vdev);
}