2
0
Эх сурвалжийг харах

ui/curses: Avoid dynamic stack allocation

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
Philippe Mathieu-Daudé 3 жил өмнө
parent
commit
2d5f4a713d
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      ui/curses.c

+ 1 - 1
ui/curses.c

@@ -69,7 +69,7 @@ static void curses_update(DisplayChangeListener *dcl,
                           int x, int y, int w, int h)
                           int x, int y, int w, int h)
 {
 {
     console_ch_t *line;
     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];
     wchar_t wch[CCHARW_MAX];
     attr_t attrs;
     attr_t attrs;
     short colors;
     short colors;