[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/12] tests/qtest: use g_autofree for test_server_create_chr
From: |
Thomas Huth |
Subject: |
[PULL 09/12] tests/qtest: use g_autofree for test_server_create_chr |
Date: |
Fri, 3 Jun 2022 08:59:02 +0200 |
From: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220524154056.2896913-12-alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/vhost-user-test.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index a2cec87684..8bf390be20 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -524,14 +524,13 @@ static void chr_event(void *opaque, QEMUChrEvent event)
static void test_server_create_chr(TestServer *server, const gchar *opt)
{
- gchar *chr_path;
+ g_autofree gchar *chr_path = g_strdup_printf("unix:%s%s",
+ server->socket_path, opt);
Chardev *chr;
- chr_path = g_strdup_printf("unix:%s%s", server->socket_path, opt);
chr = qemu_chr_new(server->chr_name, chr_path, server->context);
- g_free(chr_path);
+ g_assert(chr);
- g_assert_nonnull(chr);
qemu_chr_fe_init(&server->chr, chr, &error_abort);
qemu_chr_fe_set_handlers(&server->chr, chr_can_read, chr_read,
chr_event, NULL, server, server->context, true);
--
2.31.1
- [PULL 00/12] s390x and misc patches, Thomas Huth, 2022/06/03
- [PULL 01/12] s390: Typo fix FLOATING_POINT_SUPPPORT_ENH, Thomas Huth, 2022/06/03
- [PULL 03/12] target/s390x: kvm: Honor storage keys during emulation, Thomas Huth, 2022/06/03
- [PULL 12/12] ui: Remove deprecated options "-sdl" and "-curses", Thomas Huth, 2022/06/03
- [PULL 02/12] hw/s390x/s390-virtio-ccw: Improve the machine description string, Thomas Huth, 2022/06/03
- [PULL 05/12] tests/tcg: Test overflow conditions, Thomas Huth, 2022/06/03
- [PULL 07/12] MAINTAINERS: Update maintainers for Guest x86 HAXM CPUs, Thomas Huth, 2022/06/03
- [PULL 04/12] MAINTAINERS: Update s390 vhost entries, Thomas Huth, 2022/06/03
- [PULL 06/12] MAINTAINERS: Change my email address, Thomas Huth, 2022/06/03
- [PULL 09/12] tests/qtest: use g_autofree for test_server_create_chr,
Thomas Huth <=
- [PULL 10/12] ui: Remove deprecated parameters of the "-display sdl" option, Thomas Huth, 2022/06/03
- [PULL 08/12] qtest/npcm7xx_pwm-test: Fix memory leak in mft_qom_set, Thomas Huth, 2022/06/03
- [PULL 11/12] ui: Switch "-display sdl" to use the QAPI parser, Thomas Huth, 2022/06/03
- Re: [PULL 00/12] s390x and misc patches, Richard Henderson, 2022/06/03