summaryrefslogtreecommitdiffstats
path: root/src/screen.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-13 23:09:49 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-13 23:09:49 +0200
commit6ace95e9810bdfef5392ad89efc9e4ad4606de28 (patch)
treeb03a5540e30f1ad6fea0757682df668ff7a2fb46 /src/screen.c
parent45311b5274a6ac6e44235dfd4588c6b1bf0d4850 (diff)
patch 8.1.1845: may use NULL pointer when running out of memoryv8.1.1845
Problem: May use NULL pointer when running out of memory. Solution: Do not clear popup buffers when NULL. (closes #4802)
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/screen.c b/src/screen.c
index 55437e1476..72b346d96d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -8645,10 +8645,16 @@ give_up:
}
/* Use the last line of the screen for the current line. */
current_ScreenLine = new_ScreenLines + Rows * Columns;
+
+#ifdef FEAT_TEXT_PROP
+ vim_memset(new_popup_mask, 0, Rows * Columns * sizeof(short));
+ vim_memset(new_popup_transparent, 0, Rows * Columns * sizeof(char));
+#endif
}
free_screenlines();
+ // NOTE: this may result in all pointers to become NULL.
ScreenLines = new_ScreenLines;
ScreenLinesUC = new_ScreenLinesUC;
for (i = 0; i < p_mco; ++i)
@@ -8661,10 +8667,8 @@ give_up:
TabPageIdxs = new_TabPageIdxs;
#ifdef FEAT_TEXT_PROP
popup_mask = new_popup_mask;
- vim_memset(popup_mask, 0, Rows * Columns * sizeof(short));
popup_mask_next = new_popup_mask_next;
popup_transparent = new_popup_transparent;
- vim_memset(popup_transparent, 0, Rows * Columns * sizeof(char));
popup_mask_refresh = TRUE;
#endif