aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-06-05 21:20:23 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-06-10 12:59:09 +0200
commit2f014eabc1acc64c403557f5a51fdb1ba43bbdd1 (patch)
tree3846c33dd7846a929ce22711c8fcec2f18b597b5
parent0ff9cd9a6af54ccaa293e252aa356fb150788099 (diff)
downloadqemu-2f014eabc1acc64c403557f5a51fdb1ba43bbdd1.zip
qemu-2f014eabc1acc64c403557f5a51fdb1ba43bbdd1.tar.gz
qemu-2f014eabc1acc64c403557f5a51fdb1ba43bbdd1.tar.bz2
tests/unit/test-char: Avoid using g_alloca()
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>
-rw-r--r--tests/unit/test-char.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c
index 60a843b..f30a39f 100644
--- a/tests/unit/test-char.c
+++ b/tests/unit/test-char.c
@@ -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);
}