]> granicus.if.org Git - vim/commitdiff
patch 8.1.2406: leaking memory in test_paste and test_registers v8.1.2406
authorBram Moolenaar <Bram@vim.org>
Sat, 7 Dec 2019 16:47:22 +0000 (17:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 7 Dec 2019 16:47:22 +0000 (17:47 +0100)
Problem:    Leaking memory in test_paste and test_registers.
Solution:   Free the old title.  Don't copy expr_line.

src/os_unix.c
src/register.c
src/term.c
src/version.c

index 90c5aed97d2de5ad8cc37a953aa74165e5584a51..7e7820934b0c391544ef33d644309299f60ccc31 100644 (file)
@@ -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)
index a948bebda961b356d2d200140743a23c8df8e711..24e4b992a300c0bc527c84c33bbe76680d290755 100644 (file)
@@ -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;
        }
index 57384f4d85c7d80209a2b1a828833ae05d852667..b0ab7c634afe44fe504e193a1dc37c0dbb86a3a3 100644 (file)
@@ -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
index 89896e5a1a3fba413ac97d4bd77cce87a7da2cab..c03c3c02ab0fbcaf6e0f7760fca59680b057a1a1 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2406,
 /**/
     2405,
 /**/