0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2205: Vim9: memory leak when parsing lambda fails

Problem:    Vim9: memory leak when parsing lambda fails.
Solution:   Clear growarrays.
This commit is contained in:
Bram Moolenaar
2020-12-24 16:06:00 +01:00
parent 65c4415276
commit 6dd41b1d57
2 changed files with 10 additions and 0 deletions

View File

@@ -523,7 +523,11 @@ get_lambda_tv(
types_optional ? &argtypes : NULL, types_optional,
NULL, NULL, TRUE, NULL, NULL);
if (ret == FAIL || skip_arrow(s, equal_arrow) == NULL)
{
if (types_optional)
ga_clear_strings(&argtypes);
return NOTDONE;
}
// Parse the arguments again.
if (evaluate)
@@ -535,7 +539,11 @@ get_lambda_tv(
types_optional ? &argtypes : NULL, types_optional,
&varargs, NULL, FALSE, NULL, NULL);
if (ret == FAIL || (*arg = skip_arrow(*arg, equal_arrow)) == NULL)
{
if (types_optional)
ga_clear_strings(&argtypes);
return NOTDONE;
}
// Set up a flag for checking local variables and arguments.
if (evaluate)

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2205,
/**/
2204,
/**/