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

patch 8.2.0974: Vim9: memory leak when script var has wrong type

Problem:    Vim9: memory leak when script var has wrong type.
Solution:   Free the variable name.
This commit is contained in:
Bram Moolenaar
2020-06-13 19:56:38 +02:00
parent 34db91f7a4
commit f3decc5830
2 changed files with 5 additions and 0 deletions

View File

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

View File

@@ -477,7 +477,10 @@ vim9_declare_scriptvar(exarg_T *eap, char_u *arg)
p = skipwhite(p + 1); p = skipwhite(p + 1);
type = parse_type(&p, &si->sn_type_list); type = parse_type(&p, &si->sn_type_list);
if (called_emsg != called_emsg_before) if (called_emsg != called_emsg_before)
{
vim_free(name);
return p; return p;
}
// Create the variable with 0/NULL value. // Create the variable with 0/NULL value.
CLEAR_FIELD(init_tv); CLEAR_FIELD(init_tv);