summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-01 19:08:54 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-01 19:08:54 +0200
commit109aece79d1b5f14f6a84ff2ac068cfffebeba80 (patch)
tree0196e6848b8765e3296f601de7010a2fba156c1b
parentf9ca08e95ff5b66a02c75334264dd86508b2a453 (diff)
patch 8.2.0880: leaking memory when using searchcount()v8.2.0880
Problem: Leaking memory when using searchcount(). Solution: Free the last used search pattern.
-rw-r--r--src/search.c1
-rw-r--r--src/version.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index e0b0f9b455..a6b60f63cb 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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)
diff --git a/src/version.c b/src/version.c
index 80be6d03b3..3a7450962e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 880,
+/**/
879,
/**/
878,