]> granicus.if.org Git - vim/commitdiff
patch 8.1.2286: using border highlight in popup window leaks memory v8.1.2286
authorBram Moolenaar <Bram@vim.org>
Sun, 10 Nov 2019 14:16:54 +0000 (15:16 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 10 Nov 2019 14:16:54 +0000 (15:16 +0100)
Problem:    Using border highlight in popup window leaks memory.
Solution:   Free memory before overwriting. (Dominique Pelle, closes #5203)

src/popupwin.c
src/version.c

index ac8fff3d63db394ae557676bbc012f7913554291..41839b44a0d31983158e048161ea1b5fecc189b3 100644 (file)
@@ -755,12 +755,18 @@ apply_general_options(win_T *wp, dict_T *dict)
            {
                str = tv_get_string(&li->li_tv);
                if (*str != NUL)
+               {
+                   vim_free(wp->w_border_highlight[i]);
                    wp->w_border_highlight[i] = vim_strsave(str);
+               }
            }
            if (list->lv_len == 1 && wp->w_border_highlight[0] != NULL)
                for (i = 1; i < 4; ++i)
+               {
+                   vim_free(wp->w_border_highlight[i]);
                    wp->w_border_highlight[i] =
                                        vim_strsave(wp->w_border_highlight[0]);
+               }
        }
     }
 
index 823d4d8d692b129521e9f5ec1b0f168d5ac58de6..ab75ea75ff8e3ef31e9f889387c9a33648defe1d 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2286,
 /**/
     2285,
 /**/