aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e3a2c1ffec..3d558bdbdd 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2705,13 +2705,18 @@ win_line (
draw_state = WL_FOLD;
if (fdc > 0) {
- // Draw the 'foldcolumn'.
- fill_foldcolumn(extra, wp, false, lnum);
- n_extra = fdc;
- p_extra = extra;
- p_extra[n_extra] = NUL;
- c_extra = NUL;
- char_attr = win_hl_attr(wp, HLF_FC);
+ // Draw the 'foldcolumn'. Allocate a buffer, "extra" may
+ // already be in used.
+ p_extra_free = xmalloc(12 + 1);
+
+ if (p_extra_free != NULL) {
+ fill_foldcolumn(p_extra_free, wp, false, lnum);
+ n_extra = fdc;
+ p_extra_free[n_extra] = NUL;
+ p_extra = p_extra_free;
+ c_extra = NUL;
+ char_attr = win_hl_attr(wp, HLF_FC);
+ }
}
}