vim-patch:8.2.0880: leaking memory when using searchcount()

Problem:    Leaking memory when using searchcount().
Solution:   Free the last used search pattern.
109aece79d
This commit is contained in:
shadmansaleh
2021-04-20 22:30:46 +06:00
parent e498f265f4
commit 420344324e

View File

@@ -4607,6 +4607,7 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (*pattern == NUL) {
goto the_end;
}
xfree(spats[last_idx].pat);
spats[last_idx].pat = vim_strsave(pattern);
}
if (spats[last_idx].pat == NULL || *spats[last_idx].pat == NUL) {