changeset 26798:f40798bc2a50 v8.2.3927

patch 8.2.3927: Vim9: double free when using lambda Commit: https://github.com/vim/vim/commit/8c697e3698e7dbe0a3c4524ac360b78ceb852b23 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 28 20:18:50 2021 +0000 patch 8.2.3927: Vim9: double free when using lambda Problem: Vim9: double free when using lambda. Solution: Don't free both cmdline and line_to_free.
author Bram Moolenaar <Bram@vim.org>
date Tue, 28 Dec 2021 21:30:03 +0100
parents 616988edff61
children df4a15fb32cf
files src/userfunc.c src/version.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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;
     }
 
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3927,
+/**/
     3926,
 /**/
     3925,