diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-24 16:06:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-24 16:06:00 +0100 |
commit | 6dd41b1d575e8859238144899600e3cbb412c79b (patch) | |
tree | e653dce871c0ccf1049cc2b292ca4d2916124bc9 | |
parent | 65c4415276394c871c7a8711c7633c19ec9235b1 (diff) | |
download | vim-git-6dd41b1d575e8859238144899600e3cbb412c79b.tar.gz |
patch 8.2.2205: Vim9: memory leak when parsing lambda failsv8.2.2205
Problem: Vim9: memory leak when parsing lambda fails.
Solution: Clear growarrays.
-rw-r--r-- | src/userfunc.c | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 4da1dc038..f9f302a17 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -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) diff --git a/src/version.c b/src/version.c index df91534a8..5420862e2 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2205, +/**/ 2204, /**/ 2203, |