[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/23] ui/spice-display: Avoid dynamic stack allocation
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 17/23] ui/spice-display: Avoid dynamic stack allocation |
Date: |
Wed, 5 May 2021 23:10:41 +0200 |
Use autofree heap allocation instead of variable-length
array on the stack.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
ui/spice-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index d22781a23d0..61c4259363b 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -188,7 +188,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay
*ssd)
{
static const int blksize = 32;
int blocks = DIV_ROUND_UP(surface_width(ssd->ds), blksize);
- int dirty_top[blocks];
+ g_autofree int *dirty_top = g_new(int, blocks);
int y, yoff1, yoff2, x, xoff, blk, bw;
int bpp = surface_bytes_per_pixel(ssd->ds);
uint8_t *guest, *mirror;
--
2.26.3
- Re: [PATCH 12/23] hw/i386/multiboot: Avoid dynamic stack allocation, (continued)
- [PATCH 13/23] hw/usb/hcd-xhci: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 14/23] hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 15/23] net: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 16/23] ui/curses: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 17/23] ui/spice-display: Avoid dynamic stack allocation,
Philippe Mathieu-Daudé <=
- [PATCH 18/23] ui/vnc-enc-hextile: Use definitions to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 19/23] ui/vnc-enc-tight: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 20/23] util/iov: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 22/23] tests/unit/test-vmstate: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 23/23] configure: Prohibit variable-length allocations by using -Wvla CPPFLAG, Philippe Mathieu-Daudé, 2021/05/05