]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/unit/test-char: Avoid using g_alloca()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 5 Jun 2025 19:20:23 +0000 (21:20 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 10 Jun 2025 10:59:09 +0000 (12:59 +0200)
Do not use g_alloca(), simply allocate the CharBackend
structure on the stack.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20250605193540.59874-4-philmd@linaro.org>

tests/unit/test-char.c

index 60a843b79d92b6faea0b0792958da4dc685d94d9..f30a39f61ffa10d93b7feddb0382d4ef98873a5c 100644 (file)
@@ -993,7 +993,7 @@ static void char_udp_test_internal(Chardev *reuse_chr, int sock)
     struct sockaddr_in other;
     SocketIdleData d = { 0, };
     Chardev *chr;
-    CharBackend *be;
+    CharBackend stack_be, *be = &stack_be;
     socklen_t alen = sizeof(other);
     int ret;
     char buf[10];
@@ -1009,7 +1009,6 @@ static void char_udp_test_internal(Chardev *reuse_chr, int sock)
         chr = qemu_chr_new("client", tmp, NULL);
         g_assert_nonnull(chr);
 
-        be = g_alloca(sizeof(CharBackend));
         qemu_chr_fe_init(be, chr, &error_abort);
     }