neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 7afcfb6c9ac53cb4192974934d6cdc360f4bebc7
parent e38e65b86c473597414b1af244e74745aa4f48eb
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri, 15 Aug 2025 06:51:38 +0800

vim-patch:9.1.1632: memory leak in fuzzy.c

Problem:  memory leak in fuzzy.c
Solution: Free fuzmatch, add a few minor refactors
          (glepnir)

fixes neovim CID 584055: fuzmatch leak when count becomes 0
Fix partial allocation failure cleanup in buffer expansion

closes: vim/vim#17996

https://github.com/vim/vim/commit/03d6e06edd0aaf2f591d74349cb25dbeca5895ef

Co-authored-by: glepnir <glephunter@gmail.com>

Diffstat:
Msrc/nvim/fuzzy.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/nvim/fuzzy.c b/src/nvim/fuzzy.c @@ -690,7 +690,7 @@ void fuzzymatches_to_strmatches(fuzmatch_str_T *const fuzmatch, char ***const ma FUNC_ATTR_NONNULL_ARG(2) { if (count <= 0) { - return; + goto theend; } *matches = xmalloc((size_t)count * sizeof(char *)); @@ -705,6 +705,8 @@ void fuzzymatches_to_strmatches(fuzmatch_str_T *const fuzmatch, char ***const ma for (int i = 0; i < count; i++) { (*matches)[i] = fuzmatch[i].str; } + +theend: xfree(fuzmatch); }