Commit: patch 9.2.0799: Memory leak in compile_def_function_body() on alloc failure

1 view
Skip to first unread message

Christian Brabandt

unread,
11:00 AM (7 hours ago) 11:00 AM
to vim...@googlegroups.com
patch 9.2.0799: Memory leak in compile_def_function_body() on alloc failure

Commit: https://github.com/vim/vim/commit/304ccd74a502322ab8a01f8e62a595b93d6b9e6b
Author: Yasuhiro Matsumoto <matt...@gmail.com>
Date: Sat Jul 18 14:27:24 2026 +0000

patch 9.2.0799: Memory leak in compile_def_function_body() on alloc failure

Problem: Memory leak in compile_def_function_body() on alloc failure
Solution: Call vim_free with the line var (Yasuhiro Matsumoto).

related: #20668
related: #20745

Signed-off-by: Yasuhiro Matsumoto <matt...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/version.c b/src/version.c
index b3d1e6aed..0c85088f4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 799,
/**/
798,
/**/
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 3b1b9e9ef..65d7580f9 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4319,7 +4319,10 @@ compile_def_function_body(
{
line = vim_strsave(line);
if (ga_add_string(lines_to_free, line) == FAIL)
+ {
+ vim_free(line);
return FAIL;
+ }
}
}

Reply all
Reply to author
Forward
0 new messages