changeset 18838:8dabdfc7c799 v8.1.2406

patch 8.1.2406: leaking memory in test_paste and test_registers Commit: https://github.com/vim/vim/commit/6b649ac4fd0cbf88c5a05d82ad151d0ce980916a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 7 17:47:22 2019 +0100 patch 8.1.2406: leaking memory in test_paste and test_registers Problem: Leaking memory in test_paste and test_registers. Solution: Free the old title. Don't copy expr_line.
author Bram Moolenaar <Bram@vim.org>
date Sat, 07 Dec 2019 18:00:03 +0100
parents 00e789ecc516
children 41c35c4cf035
files src/os_unix.c src/register.c src/term.c src/version.c
diffstat 4 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1963,6 +1963,10 @@ get_x11_thing(
 	    retval = TRUE;
 	    if (!test_only)
 	    {
+		if (get_title)
+		    vim_free(oldtitle);
+		else
+		    vim_free(oldicon);
 		if (text_prop.encoding == XA_STRING && !has_mbyte)
 		{
 		    if (get_title)
--- a/src/register.c
+++ b/src/register.c
@@ -2872,9 +2872,9 @@ write_reg_contents_ex(
 	p = vim_strnsave(str, (int)len);
 	if (p == NULL)
 	    return;
-	if (must_append)
+	if (must_append && expr_line != NULL)
 	{
-	    s = concat_str(get_expr_line_src(), p);
+	    s = concat_str(expr_line, p);
 	    vim_free(p);
 	    p = s;
 	}
--- a/src/term.c
+++ b/src/term.c
@@ -2106,6 +2106,8 @@ tgetent_error(char_u *tbuf, char_u *term
 {
     int	    i;
 
+    // Note: Valgrind may report a leak here, because the library keeps one
+    // buffer around that we can't ever free.
     i = TGETENT(tbuf, term);
     if (i < 0		    // -1 is always an error
 # ifdef TGETENT_ZERO_ERR
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2406,
+/**/
     2405,
 /**/
     2404,