patch 8.2.3902: Vim9: double free with nested :def function
Problem: Vim9: double free with nested :def function.
Solution: Pass "line_to_free" from compile_def_function() and make sure
cmdlinep is valid.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 49336c0..9814f25 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3345,10 +3345,12 @@
else
{
exarg_T ea;
+ char_u *line_to_free = NULL;
CLEAR_FIELD(ea);
ea.cmd = ea.arg = iptr->isn_arg.string;
- define_function(&ea, NULL);
+ define_function(&ea, NULL, &line_to_free);
+ vim_free(line_to_free);
}
break;