]> granicus.if.org Git - vim/commitdiff
patch 8.2.0428: buffer name may leak v8.2.0428
authorBram Moolenaar <Bram@vim.org>
Sun, 22 Mar 2020 18:25:50 +0000 (19:25 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 22 Mar 2020 18:25:50 +0000 (19:25 +0100)
Problem:    Buffer name may leak.
Solution:   Free the buffer name before overwriting it.

src/terminal.c
src/version.c

index 7f440a3bd52623662ca3206d727a63a006f455ee..638c27ea65f4db2a9ba9f2bf63fb9321c63c19c3 100644 (file)
@@ -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);
 }
 
 /*
index b9542437a9b59c9cf55ecbbcb96c4e43ba7168e4..e27b7735132eebc1001a25d3384372bfffba422f 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    428,
 /**/
     427,
 /**/