]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3927: Vim9: double free when using lambda v8.2.3927
authorBram Moolenaar <Bram@vim.org>
Tue, 28 Dec 2021 20:18:50 +0000 (20:18 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 28 Dec 2021 20:18:50 +0000 (20:18 +0000)
Problem:    Vim9: double free when using lambda.
Solution:   Don't free both cmdline and line_to_free.

src/userfunc.c
src/version.c

index b87cdedb68ce87cb3e0421b7cec1566e9ad5406d..c894c5896ef2761dbeaa134488455c0e64106d3f 100644 (file)
@@ -1146,7 +1146,8 @@ lambda_function_body(
     ga_init2(&newlines, (int)sizeof(char_u *), 10);
     if (get_function_body(&eap, &newlines, NULL, &line_to_free) == FAIL)
     {
-       vim_free(cmdline);
+       if (cmdline != line_to_free)
+           vim_free(cmdline);
        goto erret;
     }
 
index e091971833209faa87518c9fd3089257a06fd784..4d8110510a0effd59888f6cd7a072cd7433148bf 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3927,
 /**/
     3926,
 /**/