Skip to content
Snippets Groups Projects
Commit d34977d6 authored by Philippe Mathieu-Daudé's avatar Philippe Mathieu-Daudé Committed by Peter Maydell
Browse files

chardev/baum: Avoid dynamic stack allocation


Use autofree heap allocation instead of variable-length
array on the stack.

Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Message-id: 20220819153931.3147384-4-peter.maydell@linaro.org
parent 1e3acd33
No related branches found
No related tags found
No related merge requests found
......@@ -299,7 +299,8 @@ static void baum_chr_accept_input(struct Chardev *chr)
static void baum_write_packet(BaumChardev *baum, const uint8_t *buf, int len)
{
Chardev *chr = CHARDEV(baum);
uint8_t io_buf[1 + 2 * len], *cur = io_buf;
g_autofree uint8_t *io_buf = g_malloc(1 + 2 * len);
uint8_t *cur = io_buf;
int room;
*cur++ = ESC;
while (len--)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment