0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.2095: leaking memory when getting item from dict

Problem:    Leaking memory when getting item from dict.
Solution:   Also free the key when not evaluating.
This commit is contained in:
Bram Moolenaar
2019-09-28 17:25:10 +02:00
parent 473952e852
commit a893194d91
2 changed files with 3 additions and 1 deletions

View File

@@ -822,7 +822,6 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
goto failret; goto failret;
} }
item = dictitem_alloc(key); item = dictitem_alloc(key);
clear_tv(&tvkey);
if (item != NULL) if (item != NULL)
{ {
item->di_tv = tv; item->di_tv = tv;
@@ -831,6 +830,7 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
dictitem_free(item); dictitem_free(item);
} }
} }
clear_tv(&tvkey);
if (**arg == '}') if (**arg == '}')
break; break;

View File

@@ -757,6 +757,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 */
/**/
2095,
/**/ /**/
2094, 2094,
/**/ /**/