From 25bc41847e495aa55ede1090f29afd2a1709b0b4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 19 Aug 2025 08:45:15 +0800 Subject: [PATCH] vim-patch:9.1.1649: attrs allocation and fuzzy growarray could leak (#35383) Problem: attrs allocation and fuzzy growarray could leak on early returns Solution: Ensure proper cleanup of allocated memory on exit paths (glepnir) closes: vim/vim#18038 https://github.com/vim/vim/commit/c7c10f8c116a87b49ef3ddb9a3b78f10375ca564 Co-authored-by: glepnir --- src/nvim/popupmenu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 17171b0bf4..6d2877badc 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -460,6 +460,10 @@ static int *pum_compute_text_attrs(char *text, hlf_T hlf, int user_hlattr) if (in_fuzzy) { ga = fuzzy_match_str_with_pos(text, leader); + if (!ga) { + xfree(attrs); + return NULL; + } } const char *ptr = text;