diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-03-22 19:25:50 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-03-22 19:25:50 +0100 |
commit | d5bc32df207eae408263ae6ab737771365d0bca1 (patch) | |
tree | 92c0e34ec8c98507a5d0499d8d062b34fa749f73 | |
parent | 7929651e05b081fe55e0e745725a7ad78c51be16 (diff) | |
download | vim-git-d5bc32df207eae408263ae6ab737771365d0bca1.tar.gz |
patch 8.2.0428: buffer name may leakv8.2.0428
Problem: Buffer name may leak.
Solution: Free the buffer name before overwriting it.
-rw-r--r-- | src/terminal.c | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c index 7f440a3bd..638c27ea6 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -465,7 +465,7 @@ term_start( buf_T *buf; // Create a new buffer without a window. Make it the current buffer for - // a moment to be able to do the initialisations. + // a moment to be able to do the initializations. buf = buflist_new((char_u *)"", NULL, (linenr_T)0, BLN_NEW | BLN_LISTED); if (buf == NULL || ml_open(buf) == FAIL) @@ -526,9 +526,15 @@ term_start( apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); if (opt->jo_term_name != NULL) + { + vim_free(curbuf->b_ffname); curbuf->b_ffname = vim_strsave(opt->jo_term_name); + } else if (argv != NULL) + { + vim_free(curbuf->b_ffname); curbuf->b_ffname = vim_strsave((char_u *)"!system"); + } else { int i; @@ -1983,7 +1989,7 @@ term_enter_job_mode() redraw_buf_and_status_later(curbuf, NOT_VALID); #ifdef FEAT_PROP_POPUP if (WIN_IS_POPUP(curwin)) - redraw_win_later(curwin, NOT_VALID); + redraw_later(NOT_VALID); #endif } @@ -4321,6 +4327,8 @@ term_update_colors(void) vterm_obtain_state(term->tl_vterm), &term->tl_default_color.fg, &term->tl_default_color.bg); + + redraw_later(NOT_VALID); } /* diff --git a/src/version.c b/src/version.c index b9542437a..e27b77351 100644 --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 428, +/**/ 427, /**/ 426, |