changeset 18584:351659cbadb4 v8.1.2286

patch 8.1.2286: using border highlight in popup window leaks memory Commit: https://github.com/vim/vim/commit/622b64603748cceafd47f7537b96610e824e0680 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 10 15:16:54 2019 +0100 patch 8.1.2286: using border highlight in popup window leaks memory Problem: Using border highlight in popup window leaks memory. Solution: Free memory before overwriting. (Dominique Pelle, closes https://github.com/vim/vim/issues/5203)
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Nov 2019 15:30:03 +0100
parents cc918e1f4ed6
children 48022f69edd9
files src/popupwin.c src/version.c
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -755,12 +755,18 @@ apply_general_options(win_T *wp, dict_T 
 	    {
 		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]);
+		}
 	}
     }
 
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2286,
+/**/
     2285,
 /**/
     2284,