]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.0974: Vim9: memory leak when script var has wrong type v8.2.0974
authorBram Moolenaar <Bram@vim.org>
Sat, 13 Jun 2020 17:56:38 +0000 (19:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 13 Jun 2020 17:56:38 +0000 (19:56 +0200)
Problem:    Vim9: memory leak when script var has wrong type.
Solution:   Free the variable name.

src/version.c
src/vim9script.c

index d2f442c89a279a86ad1c9c74c5aca445cd9be5ce..1f91903289a487a16abd95f1aadad5e7d2a5af2a 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    974,
 /**/
     973,
 /**/
index 13a29ec3a92a2312b8cf302be88ecc41320e33e9..650168419cf0a7206c987946b342a38c3fb64187 100644 (file)
@@ -477,7 +477,10 @@ vim9_declare_scriptvar(exarg_T *eap, char_u *arg)
     p = skipwhite(p + 1);
     type = parse_type(&p, &si->sn_type_list);
     if (called_emsg != called_emsg_before)
+    {
+       vim_free(name);
        return p;
+    }
 
     // Create the variable with 0/NULL value.
     CLEAR_FIELD(init_tv);