1
0
forked from aniani/vim

patch 8.2.0880: leaking memory when using searchcount()

Problem:    Leaking memory when using searchcount().
Solution:   Free the last used search pattern.
This commit is contained in:
Bram Moolenaar
2020-06-01 19:08:54 +02:00
parent f9ca08e95f
commit 109aece79d
2 changed files with 3 additions and 0 deletions

View 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)