virtio-serial: delete timer if active during exit
authorAmit Shah <amit.shah@redhat.com>
Thu, 13 Dec 2012 10:24:43 +0000 (15:54 +0530)
committerAmit Shah <amit.shah@redhat.com>
Thu, 13 Dec 2012 10:31:26 +0000 (16:01 +0530)
The post_load timer was being freed, but not deleted.  This could cause
problems when the timer is armed, but the device is hot-unplugged before
the callback is executed.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
hw/virtio-serial-bus.c

index 09d46593e2c27e2e1b3f691dff8a6f0f38e81b7b..fc0166ca7f845e9befa10581846c7d604283f82c 100644 (file)
@@ -1038,6 +1038,7 @@ void virtio_serial_exit(VirtIODevice *vdev)
     g_free(vser->ports_map);
     if (vser->post_load) {
         g_free(vser->post_load->connected);
+        qemu_del_timer(vser->post_load->timer);
         qemu_free_timer(vser->post_load->timer);
         g_free(vser->post_load);
     }