From 420344324e3abcb9766d03b08758e719aee746d0 Mon Sep 17 00:00:00 2001 From: shadmansaleh Date: Tue, 20 Apr 2021 22:30:46 +0600 Subject: vim-patch:8.2.0880: leaking memory when using searchcount() Problem: Leaking memory when using searchcount(). Solution: Free the last used search pattern. https://github.com/vim/vim/commit/109aece79d1b5f14f6a84ff2ac068cfffebeba80 --- src/nvim/search.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nvim/search.c b/src/nvim/search.c index adb7376ce3..ba7c5efa83 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -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) { -- cgit