summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-23 18:51:11 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-23 18:51:11 +0200
commit4ee711f21389066fa157961feed17692fc16bf8e (patch)
treee02911ce60d4dd8d3f82e0ded8bda1fa6068520c /src
parent6bf1b52ba2816dffdbd0d994320abfb1586bf666 (diff)
downloadvim-git-4ee711f21389066fa157961feed17692fc16bf8e.tar.gz
patch 8.2.1733: Vim9: memory leaks when using nested functionv8.2.1733
Problem: Vim9: memory leaks when using nested function. Solution: Free function when compilation fails.
Diffstat (limited to 'src')
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/version.c b/src/version.c
index e3d61eb99..033a34b10 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 */
/**/
+ 1733,
+/**/
1732,
/**/
1731,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 06ee2f5a8..2b93dea82 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4408,7 +4408,10 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
return eap->skip ? (char_u *)"" : NULL;
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
&& compile_def_function(ufunc, TRUE, cctx) == FAIL)
+ {
+ func_ptr_unref(ufunc);
return NULL;
+ }
if (is_global)
{