Cc: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 qemu-char.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/qemu-char.c b/qemu-char.c
index f7f5464..2ca34cd 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);
-- 
1.8.3.1


Reply via email to