On Sun, Mar 28, 2010 at 08:39:42PM +0200, Samuel Thibault wrote:
> Hello,
> 
> This adds a destroy hook for the baum character device, to properly
> close the BrlAPI connection and free resources.
> 
> Signed-off-by: Samuel Thibault <samuel.thiba...@ens-lyon.org>

Thanks, applied.

> commit 447c41758cfda0022ea6e09aaf81137b2b27b915
> Author: Samuel Thibault <samuel.thiba...@ens-lyon.org>
> Date:   Sun Mar 28 20:38:38 2010 +0200
> 
>     baum: add destroy hook
>     
>     Add a destroy hook for the baum character device, to properly close the 
> BrlAPI
>     connection.
> 
> diff --git a/hw/baum.c b/hw/baum.c
> index 18633f4..21326ae 100644
> --- a/hw/baum.c
> +++ b/hw/baum.c
> @@ -564,6 +564,18 @@ static void baum_chr_read(void *opaque)
>      }
>  }
>  
> +static void baum_close(struct CharDriverState *chr)
> +{
> +    BaumDriverState *baum = chr->opaque;
> +
> +    qemu_free_timer(baum->cellCount_timer);
> +    if (baum->brlapi) {
> +        brlapi__closeConnection(baum->brlapi);
> +        qemu_free(baum->brlapi);
> +    }
> +    qemu_free(baum);
> +}
> +
>  CharDriverState *chr_baum_init(QemuOpts *opts)
>  {
>      BaumDriverState *baum;
> @@ -581,6 +593,7 @@ CharDriverState *chr_baum_init(QemuOpts *opts)
>      chr->chr_write = baum_write;
>      chr->chr_send_event = baum_send_event;
>      chr->chr_accept_input = baum_accept_input;
> +    chr->chr_close = baum_close;
>  
>      handle = qemu_mallocz(brlapi_getHandleSize());
>      baum->brlapi = handle;
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurel...@aurel32.net                 http://www.aurel32.net


Reply via email to