patch 9.1.1649: attrs allocation and fuzzy growarray could leak

Commit: 
https://github.com/vim/vim/commit/c7c10f8c116a87b49ef3ddb9a3b78f10375ca564
Author: glepnir <glephun...@gmail.com>
Date:   Mon Aug 18 21:09:18 2025 +0200

    patch 9.1.1649: attrs allocation and fuzzy growarray could leak
    
    Problem:  attrs allocation and fuzzy growarray could leak on early
              returns
    Solution: Ensure proper cleanup of allocated memory on exit paths
              (glepnir)
    
    closes: #18038
    
    Signed-off-by: glepnir <glephun...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/popupmenu.c b/src/popupmenu.c
index 9456faae3..59966ea79 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -51,14 +51,13 @@ static int pum_set_selected(int n, int repeat);
     static void
 pum_compute_size(void)
 {
-    int        i;
     int        w;
 
     // Compute the width of the widest match and the widest extra.
     pum_base_width = 0;
     pum_kind_width = 0;
     pum_extra_width = 0;
-    for (i = 0; i < pum_size; ++i)
+    for (int i = 0; i < pum_size; ++i)
     {
        if (pum_array[i].pum_text != NULL)
        {
@@ -454,7 +453,14 @@ pum_compute_text_attrs(char_u *text, hlf_T hlf, int 
user_hlattr)
     leader_len = STRLEN(leader);
 
     if (in_fuzzy)
+    {
        ga = fuzzy_match_str_with_pos(text, leader);
+       if (!ga)
+       {
+           vim_free(attrs);
+           return NULL;
+       }
+    }
 
     while (*ptr != NUL)
     {
diff --git a/src/version.c b/src/version.c
index 903c0960d..8f351ed07 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1649,
 /**/
     1648,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uo5K0-005O9Q-SH%40256bit.org.

Raspunde prin e-mail lui