0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1664: memory leak when using :mkview with a terminal buffer

Problem:    Memory leak when using :mkview with a terminal buffer.
Solution:   Don't use a hastab for :mkview. (Rob Pilling, closes #6935)
This commit is contained in:
Bram Moolenaar
2020-09-11 22:10:22 +02:00
parent 14944c04bd
commit c2c8205634
4 changed files with 40 additions and 25 deletions

View File

@@ -940,7 +940,7 @@ term_write_session(FILE *fd, win_T *wp, hashtab_T *terminal_bufs)
const int bufnr = wp->w_buffer->b_fnum;
term_T *term = wp->w_buffer->b_term;
if (wp->w_buffer->b_nwindows > 1)
if (terminal_bufs != NULL && wp->w_buffer->b_nwindows > 1)
{
// There are multiple views into this terminal buffer. We don't want to
// create the terminal multiple times. If it's the first time, create,
@@ -978,7 +978,7 @@ term_write_session(FILE *fd, win_T *wp, hashtab_T *terminal_bufs)
if (fprintf(fd, "let s:term_buf_%d = bufnr()", bufnr) < 0)
return FAIL;
if (wp->w_buffer->b_nwindows > 1)
if (terminal_bufs != NULL && wp->w_buffer->b_nwindows > 1)
{
char *hash_key = alloc(NUMBUFLEN);