From: Bram Moolenaar Date: Mon, 1 Jun 2020 17:08:54 +0000 (+0200) Subject: patch 8.2.0880: leaking memory when using searchcount() X-Git-Tag: v8.2.0880 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=109aece79d1b5f14f6a84ff2ac068cfffebeba80;p=thirdparty%2Fvim.git patch 8.2.0880: leaking memory when using searchcount() Problem: Leaking memory when using searchcount(). Solution: Free the last used search pattern. --- 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 @@ -746,6 +746,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 880, /**/ 879, /**/