From 418400075ac94eb4d1caaad1cd5251d994bf2a91 Mon Sep 17 00:00:00 2001 From: Huihui Huang <625173@qq.com> Date: Wed, 25 Mar 2026 19:51:42 +0000 Subject: [PATCH] patch 9.2.0246: memory leak in globpath() 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 --- src/cmdexpand.c | 5 +++++ src/version.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 4916465e8a..63757179a5 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -4219,6 +4219,11 @@ globpath( ++ga->ga_len; } } + else + { + FreeWild(num_p, p); + p = NULL; + } vim_free(p); } } diff --git a/src/version.c b/src/version.c index 9edef9b900..b38010c071 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 246, /**/ 245, /**/