|
|
9ae3a8 |
From c4a5b67ffac094aa1653de8e9369585b0bc4ee46 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 14 Oct 2013 13:35:19 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 12/18] qemu-char: minor mux chardev fixes
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1381757723-23134-12-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 54861
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH 11/15] qemu-char: minor mux chardev fixes
|
|
|
9ae3a8 |
Bugzilla: 922010
|
|
|
9ae3a8 |
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
mux failure path has a memory leak. creating a mux chardev can't
|
|
|
9ae3a8 |
fail though, so just assert() that instead of fixing an error path
|
|
|
9ae3a8 |
which never ever runs anyway ...
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Also fix bid being leaked while being at it.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
|
9ae3a8 |
(cherry picked from commit dc2c4eca89ec5ee7b7a4c2563c991a14a7c5ee84)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-char.c | 7 +++----
|
|
|
9ae3a8 |
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-char.c | 7 +++----
|
|
|
9ae3a8 |
1 files changed, 3 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/qemu-char.c b/qemu-char.c
|
|
|
9ae3a8 |
index b41bda4..145fd30 100644
|
|
|
9ae3a8 |
--- a/qemu-char.c
|
|
|
9ae3a8 |
+++ b/qemu-char.c
|
|
|
9ae3a8 |
@@ -3213,7 +3213,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
|
|
|
9ae3a8 |
ChardevBackend *backend = g_new0(ChardevBackend, 1);
|
|
|
9ae3a8 |
ChardevReturn *ret = NULL;
|
|
|
9ae3a8 |
const char *id = qemu_opts_id(opts);
|
|
|
9ae3a8 |
- const char *bid = NULL;
|
|
|
9ae3a8 |
+ char *bid = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (qemu_opt_get_bool(opts, "mux", 0)) {
|
|
|
9ae3a8 |
bid = g_strdup_printf("%s-base", id);
|
|
|
9ae3a8 |
@@ -3240,9 +3240,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
|
|
|
9ae3a8 |
backend->kind = CHARDEV_BACKEND_KIND_MUX;
|
|
|
9ae3a8 |
backend->mux->chardev = g_strdup(bid);
|
|
|
9ae3a8 |
ret = qmp_chardev_add(id, backend, errp);
|
|
|
9ae3a8 |
- if (error_is_set(errp)) {
|
|
|
9ae3a8 |
- goto qapi_out;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
+ assert(!error_is_set(errp));
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
chr = qemu_chr_find(id);
|
|
|
9ae3a8 |
@@ -3251,6 +3249,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
|
|
|
9ae3a8 |
qapi_out:
|
|
|
9ae3a8 |
qapi_free_ChardevBackend(backend);
|
|
|
9ae3a8 |
qapi_free_ChardevReturn(ret);
|
|
|
9ae3a8 |
+ g_free(bid);
|
|
|
9ae3a8 |
return chr;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|