]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0246: memory leak in globpath() v9.2.0246
authorHuihui Huang <625173@qq.com>
Wed, 25 Mar 2026 19:51:42 +0000 (19:51 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 25 Mar 2026 19:51:42 +0000 (19:51 +0000)
Problem:  memory leak in globpath()
Solution: Free the individual allocated strings when ga_grow() fails
          (Huihui Huang)

closes: #19817

Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/cmdexpand.c
src/version.c

index 4916465e8a36026eab59482efdcd65dd01de8540..63757179a5728978ac43d6d6dfc08c1e2f8c2bdf 100644 (file)
@@ -4219,6 +4219,11 @@ globpath(
                        ++ga->ga_len;
                    }
                }
+               else
+               {
+                   FreeWild(num_p, p);
+                   p = NULL;
+               }
                vim_free(p);
            }
        }
index 9edef9b900cdd87f7d4d6cf5969025b11e36b54d..b38010c071329aeea05ec64caa0800b9b2bbcd37 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    246,
 /**/
     245,
 /**/