qemu-block
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]