diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-08-07 22:08:05 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-08-07 22:08:05 +0200 |
commit | 7fadbf83256bb823b994a52758127594dd82ab39 (patch) | |
tree | 1c2f276c60a55e57acd6ca3a2c09a85affbc6b20 /src/terminal.c | |
parent | 75373f38087dd756babdbbf9f14fd4711712c5de (diff) | |
download | vim-7fadbf83256bb823b994a52758127594dd82ab39.zip |
patch 8.0.0891: uninitialized memory use with empty line in terminal
Problem: Uninitialized memory use with empty line in terminal.
Solution: Initialize growarray earlier. (Yasuhiro Matsumoto, closes #1949)
Diffstat (limited to 'src/terminal.c')
-rw-r--r-- | src/terminal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/terminal.c b/src/terminal.c index 7029f49ab..9743468f2 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -1346,11 +1346,11 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user) if (cells[i].chars[0] != 0) len = i + 1; + ga_init2(&ga, 1, 100); if (len > 0) p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); if (p != NULL) { - ga_init2(&ga, 1, 100); for (col = 0; col < len; col += cells[col].width) { if (ga_grow(&ga, MB_MAXBYTES) == FAIL) |