aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2022-05-24 16:40:52 +0100
committerThomas Huth <thuth@redhat.com>2022-06-03 08:03:28 +0200
commit55c269829de131d611103a7e643d48fe3bd08299 (patch)
tree8773bbd5deefa162a6d8787723ada85f0afbc8ca /tests
parentd412597ec5a8406b2af6aa5fb7740e77c1bd3f8c (diff)
downloadqemu-55c269829de131d611103a7e643d48fe3bd08299.zip
qemu-55c269829de131d611103a7e643d48fe3bd08299.tar.gz
qemu-55c269829de131d611103a7e643d48fe3bd08299.tar.bz2
tests/qtest: use g_autofree for test_server_create_chr
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/vhost-user-test.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index a2cec87..8bf390b 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);