]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.0880: leaking memory when using searchcount() v8.2.0880
authorBram Moolenaar <Bram@vim.org>
Mon, 1 Jun 2020 17:08:54 +0000 (19:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 1 Jun 2020 17:08:54 +0000 (19:08 +0200)
Problem:    Leaking memory when using searchcount().
Solution:   Free the last used search pattern.

src/search.c
src/version.c

index e0b0f9b455f48c599d05c7a5d1ffd00240f69613..a6b60f63cba7062a9a74dfd95bffcf1c212a0d35 100644 (file)
@@ -4147,6 +4147,7 @@ f_searchcount(typval_T *argvars, typval_T *rettv)
     {
        if (*pattern == NUL)
            goto the_end;
+       vim_free(spats[last_idx].pat);
        spats[last_idx].pat = vim_strsave(pattern);
     }
     if (spats[last_idx].pat == NULL || *spats[last_idx].pat == NUL)
index 80be6d03b387b635e75140f98cfb6354fc6744fc..3a7450962e025e51e761aa058c49537ef6f98545 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    880,
 /**/
     879,
 /**/