]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0799: Memory leak in compile_def_function_body() on alloc failure v9.2.0799
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Sat, 18 Jul 2026 14:27:24 +0000 (14:27 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 18 Jul 2026 14:27:24 +0000 (14:27 +0000)
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 <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/version.c
src/vim9compile.c

index b3d1e6aed7dbf79e3b79345022d06d5a073fa274..0c85088f490836212fa95b15a1584b4578bc19a4 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    799,
 /**/
     798,
 /**/
index 3b1b9e9ef8f0915dce8de653e82bc5faf230345d..65d7580f90cbf7e381c23096b50d97f526d33f22 100644 (file)
@@ -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;
+               }
            }
        }