aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-09-13 12:48:47 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-10-01 10:16:04 +0200
commitee6ee83de29923483b4905b35f18abf5333f6ea9 (patch)
treec0cd89a873cb064a03640488817c9bdff4a3f2cd
parenta684f3cf9b9b9c3cb82be87aafc463de8974610c (diff)
chardev: handle qmp_chardev_add(KIND_MUX) failure
Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--qemu-char.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index f7f5464b67..2ca34cd710 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3271,7 +3271,12 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
backend->kind = CHARDEV_BACKEND_KIND_MUX;
backend->mux->chardev = g_strdup(bid);
ret = qmp_chardev_add(id, backend, errp);
- assert(!error_is_set(errp));
+ if (error_is_set(errp)) {
+ chr = qemu_chr_find(bid);
+ qemu_chr_delete(chr);
+ chr = NULL;
+ goto qapi_out;
+ }
}
chr = qemu_chr_find(id);