On 07/28/2016 08:37 AM, marcandre.lur...@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lur...@redhat.com>
> 
> Similarly to other chr_close callbacks, free char type specific data.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
> ---
>  qemu-char.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 6ed6dd6..e276485 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -786,6 +786,14 @@ static GSource *mux_chr_add_watch(CharDriverState *s, 
> GIOCondition cond)
>      return d->drv->chr_add_watch(d->drv, cond);
>  }
>  
> +static void mux_chr_close(struct CharDriverState *chr)
> +{
> +    MuxDriver *d = chr->opaque;
> +
> +    /* is more cleanup needed? */

This comment is not re-assuring.

> +    g_free(d);
> +}

I looked at MuxDriver; the pointers in chr_can_read, chr_read, and
chr_event are not allocated (since they are addresses of callback
functions), ext_opaque is untouched (owned by the caller, not something
we allocate), and drv is a back-reference; and there are no other
pointers.  So this looks correct.

With the bad comment removed,
Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to