Blob Blame History Raw
From a498fc16bc9b1bfa983a95ca97dae183d8d4627e Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 14 Oct 2013 13:35:23 +0200
Subject: [PATCH 16/18] chardev: handle qmp_chardev_add(KIND_MUX) failure

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1381757723-23134-16-git-send-email-kraxel@redhat.com>
Patchwork-id: 54860
O-Subject: [RHEL-7 qemu-kvm PATCH 15/15] chardev: handle qmp_chardev_add(KIND_MUX) failure
Bugzilla: 922010
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ee6ee83de29923483b4905b35f18abf5333f6ea9)
---
 qemu-char.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 qemu-char.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index bacc7b7..983f686 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3255,7 +3255,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.7.1