From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUCfc-00010B-NC for qemu-devel@nongnu.org; Mon, 01 Aug 2016 08:50:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUCfY-0000tM-UT for qemu-devel@nongnu.org; Mon, 01 Aug 2016 08:50:12 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:32835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUCfY-0000su-Nl for qemu-devel@nongnu.org; Mon, 01 Aug 2016 08:50:08 -0400 Received: by mail-wm0-x242.google.com with SMTP id o80so26021643wme.0 for ; Mon, 01 Aug 2016 05:50:08 -0700 (PDT) Sender: Paolo Bonzini References: <20160728143808.13707-1-marcandre.lureau@redhat.com> <20160728143808.13707-21-marcandre.lureau@redhat.com> From: Paolo Bonzini Message-ID: <73a3724b-8625-852e-fa83-4b61529b2ccc@redhat.com> Date: Mon, 1 Aug 2016 14:50:06 +0200 MIME-Version: 1.0 In-Reply-To: <20160728143808.13707-21-marcandre.lureau@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org On 28/07/2016 16:37, marcandre.lureau@redhat.com wrote: > From: Marc-André Lureau > > Similarly to other chr_close callbacks, free char type specific data. > > Signed-off-by: Marc-André Lureau > --- > 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? */ Perhaps qemu_chr_free(d->drv)? Paolo > + g_free(d); > +} > + > static CharDriverState *qemu_chr_open_mux(const char *id, > ChardevBackend *backend, > ChardevReturn *ret, Error **errp) > @@ -810,6 +818,7 @@ static CharDriverState *qemu_chr_open_mux(const char *id, > chr->opaque = d; > d->drv = drv; > d->focus = -1; > + chr->chr_close = mux_chr_close; > chr->chr_write = mux_chr_write; > chr->chr_update_read_handler = mux_chr_update_read_handler; > chr->chr_accept_input = mux_chr_accept_input; >