serial: fix memory leak in serial exit
PATCH 1/1 serial: fix memory leak in serial exit
From: Li Qiang <[email protected]>
The serial_exit_core function doesn't free some resources. This can lead memory leak when hotplug and unplug. This patch avoid this.
--- hw/char/serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
hw/char/serial.c +10 -0
@@ -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); }
Signature · 1 line
1.8.3.1
Quoted 23 lines · Li Qiang
From: Li Qiang <[email protected]>
The
serial_exit_corefunction 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]>--- hw/char/serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+)hw/char/serial.c +3
-0@@ -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);
hw/char/serial.c void serial_realize_core(SerialState *s, Error **errp) · line 921
Quoted 10 lines
hw/char/serial.c +7
-0+ +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); }
Thanks, looks good.
Paolo
Michael S. Tsirkin
Acked-byQuoted 39 lines · Paolo Bonzini
Quoted 23 lines · Li Qiang
From: Li Qiang <[email protected]>
The
serial_exit_corefunction 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]>--- hw/char/serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+)hw/char/serial.c +3
-0@@ -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);hw/char/serial.c void serial_realize_core(SerialState *s, Error **errp) · line 921
Quoted 10 lines
hw/char/serial.c +7
-0+ +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); }Thanks, looks good.
Quoted 1 line
Paolo
Paolo, so are you merging this?
Signature · 1 line
MST
Quoted 40 lines · Michael S. Tsirkin
Quoted 39 lines · Paolo Bonzini
Quoted 23 lines · Li Qiang
From: Li Qiang <[email protected]>
The
serial_exit_corefunction 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]>--- hw/char/serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+)hw/char/serial.c +3
-0@@ -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);hw/char/serial.c void serial_realize_core(SerialState *s, Error **errp) · line 921
Quoted 10 lines
hw/char/serial.c +7
-0+ +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); }Thanks, looks good.
Quoted 6 lines
Quoted 1 line
Paolo
Paolo, so are you merging this?
Yes, thanks.
Paolo