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
This commit is contained in:
Volodymyr Chernetskyi
2026-09-04 15:42:09 +02:00
committed by GitHub
parent efd1b66401
commit 6112d4a674

View File

@@ -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);
}