]> Git Repo - qemu.git/commitdiff
serial: fix memory leak in serial exit
authorLi Qiang <[email protected]>
Wed, 4 Jan 2017 08:43:16 +0000 (00:43 -0800)
committerPaolo Bonzini <[email protected]>
Mon, 16 Jan 2017 16:52:35 +0000 (17:52 +0100)
The serial_exit_core function doesn't free some resources.
This can lead memory leak when hotplug and unplug. This
patch avoid this.

Signed-off-by: Li Qiang <[email protected]>
Message-Id: <586cb5ab.f31d9d0a[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/char/serial.c

index ffbacd822708ea474bcd9a29d1678c7f3ee715f5..67b18eda125d154afbbfb7eb89728db98016b5fd 100644 (file)
@@ -906,6 +906,16 @@ void serial_realize_core(SerialState *s, Error **errp)
 void serial_exit_core(SerialState *s)
 {
     qemu_chr_fe_deinit(&s->chr);
+
+    timer_del(s->modem_status_poll);
+    timer_free(s->modem_status_poll);
+
+    timer_del(s->fifo_timeout_timer);
+    timer_free(s->fifo_timeout_timer);
+
+    fifo8_destroy(&s->recv_fifo);
+    fifo8_destroy(&s->xmit_fifo);
+
     qemu_unregister_reset(serial_reset, s);
 }
 
This page took 0.02835 seconds and 4 git commands to generate.