summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-07-14 04:14:13 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2016-08-08 00:00:15 +0400
commit1371a3693650c4cf5f12bc103a8c0dae83e6de15 (patch)
treed41a3d219c8be418ab8f46703920e60e6c849834
parent5b498459b441f4639fd4c39c35345637bfc6c16c (diff)
downloadqemu-1371a3693650c4cf5f12bc103a8c0dae83e6de15.zip
char: free MuxDriver when closing
Similarly to other chr_close callbacks, free char type specific data. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
-rw-r--r--qemu-char.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 7c529b2b48..8a0ab05a7b 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -786,6 +786,13 @@ 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;
+
+ g_free(d);
+}
+
static CharDriverState *qemu_chr_open_mux(const char *id,
ChardevBackend *backend,
ChardevReturn *ret, Error **errp)
@@ -810,6 +817,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;