]> granicus.if.org Git - vim/commitdiff
patch 8.2.1733: Vim9: memory leaks when using nested function v8.2.1733
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Sep 2020 16:51:11 +0000 (18:51 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Sep 2020 16:51:11 +0000 (18:51 +0200)
Problem:    Vim9: memory leaks when using nested function.
Solution:   Free function when compilation fails.

src/version.c
src/vim9compile.c

index e3d61eb99c409d85d304065f2a11d7dacf61362b..033a34b10ec39bd01fab478fad0e57b1e4335f86 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1733,
 /**/
     1732,
 /**/
index 06ee2f5a8c3afaa6abbd3c6af1398f7108e330ad..2b93dea827e4e2b3c4c5f873a854a5055364e57d 100644 (file)
@@ -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)
     {