37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
|
|
From 6c3d7f8453cf7f18eed0c605ba2a7911caf9714b Mon Sep 17 00:00:00 2001
|
||
|
|
From: Liu Jing <liujing_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Tue, 22 Oct 2024 03:47:05 +0800
|
||
|
|
Subject: [PATCH] ui/curses: Avoid dynamic stack allocation
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
Use autofree heap allocation instead of variable-length
|
||
|
|
array on the stack.
|
||
|
|
|
||
|
|
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||
|
|
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||
|
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
|
Message-id: 20220819153931.3147384-11-peter.maydell@linaro.org
|
||
|
|
Signed-off-by: Liu Jing <liujing_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
ui/curses.c | 2 +-
|
||
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/ui/curses.c b/ui/curses.c
|
||
|
|
index 861d63244c..de962faa7c 100644
|
||
|
|
--- a/ui/curses.c
|
||
|
|
+++ b/ui/curses.c
|
||
|
|
@@ -69,7 +69,7 @@ static void curses_update(DisplayChangeListener *dcl,
|
||
|
|
int x, int y, int w, int h)
|
||
|
|
{
|
||
|
|
console_ch_t *line;
|
||
|
|
- cchar_t curses_line[width];
|
||
|
|
+ g_autofree cchar_t *curses_line = g_new(cchar_t, width);
|
||
|
|
wchar_t wch[CCHARW_MAX];
|
||
|
|
attr_t attrs;
|
||
|
|
short colors;
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|