[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 18/17] tests/unit/test-char: Replace g_alloca() by buffer on t
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 18/17] tests/unit/test-char: Replace g_alloca() by buffer on the stack |
Date: |
Fri, 7 May 2021 19:19:48 +0200 |
The ALLOCA(3) man-page mentions its "use is discouraged".
Directly reserve the CharBackend on the stack.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
tests/unit/test-char.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c
index 5b3b48ebacd..54ce26226b3 100644
--- a/tests/unit/test-char.c
+++ b/tests/unit/test-char.c
@@ -574,7 +574,7 @@ static void char_udp_test_internal(Chardev *reuse_chr, int
sock)
struct sockaddr_in other;
SocketIdleData d = { 0, };
Chardev *chr;
- CharBackend *be;
+ CharBackend tmpbe, *be = &tmpbe;
socklen_t alen = sizeof(other);
int ret;
char buf[10];
@@ -590,7 +590,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);
}
--
2.26.3
- Re: [PATCH v3 14/17] hw/misc/pca9552: Replace g_newa() by g_new(), (continued)
- [PATCH v3 11/17] backends/tpm: Replace g_alloca() by g_malloc(), Philippe Mathieu-Daudé, 2021/05/07
- [PATCH v3 13/17] gdbstub: Replace GdbCmdContext with plain g_array(), Philippe Mathieu-Daudé, 2021/05/07
- [PATCH v3 12/17] gdbstub: Constify GdbCmdParseEntry, Philippe Mathieu-Daudé, 2021/05/07
- [NOTFORMERGE PATCH v3 17/17] configure: libSLiRP buildsys kludge, Philippe Mathieu-Daudé, 2021/05/07
- [PATCH v3 15/17] target/ppc/kvm: Replace alloca() by g_malloc(), Philippe Mathieu-Daudé, 2021/05/07
- [PATCH v3 16/17] configure: Prohibit alloca() by using -Walloca CPPFLAG, Philippe Mathieu-Daudé, 2021/05/07
- [PATCH v3 18/17] tests/unit/test-char: Replace g_alloca() by buffer on the stack,
Philippe Mathieu-Daudé <=