qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] serial: fix memory leak in serial exit


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] serial: fix memory leak in serial exit
Date: Wed, 4 Jan 2017 12:43:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


On 04/01/2017 09:43, Li Qiang wrote:
> From: Li Qiang <address@hidden>
> 
> 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 <address@hidden>
> ---
>  hw/char/serial.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index ffbacd8..67b18ed 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -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);
>  }
>  
> 

Thanks, looks good.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]