From 6112d4a6741e10401fce0d7728cd89398878a77a Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi Date: Fri, 4 Sep 2026 15:42:09 +0200 Subject: [PATCH] fix(fuzzy): fuzmatch_str_free() frees the wrong element #41691 Problem: The loop frees `fuzmatch[count].str` on every iteration instead of `fuzmatch[i].str`. The function has no callers in Nvim, so there is no impact today. The indexing is a slip from the port; Vim's implementation is correct. Solution: Index with the loop variable, as Vim does. AI-assisted --- src/nvim/fuzzy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/fuzzy.c b/src/nvim/fuzzy.c index 0cce8d7f50..cab1c3e0b4 100644 --- a/src/nvim/fuzzy.c +++ b/src/nvim/fuzzy.c @@ -700,7 +700,7 @@ void fuzmatch_str_free(fuzmatch_str_T *const fuzmatch, int count) return; } for (int i = 0; i < count; i++) { - xfree(fuzmatch[count].str); + xfree(fuzmatch[i].str); } xfree(fuzmatch); }