[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing |
Date: |
Thu, 28 Jul 2016 16:02:09 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 07/28/2016 08:37 AM, address@hidden wrote:
> From: Marc-André Lureau <address@hidden>
>
> Similarly to other chr_close callbacks, free char type specific data.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> 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 <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 12/37] tests: fix leak in test-string-input-visitor, (continued)
- [Qemu-devel] [PATCH v2 12/37] tests: fix leak in test-string-input-visitor, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 13/37] portio: keep references on portio, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 15/37] pc: simplify passing qemu_irq, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 14/37] numa: do not leak NumaOptions, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 16/37] pc: don't leak a20_line, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 17/37] machine: use class base init generated name, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 18/37] acpi-build: fix array leak, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 19/37] char: disconnect peer when qemu_chr_free(), marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing, marcandre . lureau, 2016/07/28
- Re: [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing,
Eric Blake <=
- [Qemu-devel] [PATCH v2 21/37] tests: fix qom-test leaks, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 22/37] pc: free i8259, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 23/37] pc: keep gsi reference, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 24/37] ahci: free irqs array, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 25/37] sd: free timer, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 26/37] qjson: free str, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 27/37] virtio-input: free config list, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 28/37] ipmi: free extern timer, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 29/37] usb: free USBDevice.strings, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 30/37] tests: free a bunch of qmp responses, marcandre . lureau, 2016/07/28