patch 8.2.3560: using freed memory with lambda
Problem: Using freed memory with lambda.
Solution: Do not free lines early, keep them until the expression is
finished.
diff --git a/src/structs.h b/src/structs.h
index 114135a..8ffebf3 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1906,8 +1906,11 @@
// pointer to the last line obtained with getsourceline()
char_u *eval_tofree;
- // pointer to the last line of an inline function
- char_u *eval_tofree_cmdline;
+ // array with lines of an inline function
+ garray_T eval_tofree_ga;
+
+ // set when "arg" points into the last entry of "eval_tofree_ga"
+ int eval_using_cmdline;
// pointer to the lines concatenated for a lambda.
char_u *eval_tofree_lambda;