vim-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.
a893194d91
This commit is contained in:
Jan Edmund Lazo 2019-09-28 14:52:17 -04:00
parent 74947203af
commit 8b67c8f8c6
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -5746,13 +5746,13 @@ static int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate)
goto failret;
}
item = tv_dict_item_alloc((const char *)key);
tv_clear(&tvkey);
item->di_tv = tv;
item->di_tv.v_lock = 0;
if (tv_dict_add(d, item) == FAIL) {
tv_dict_item_free(item);
}
}
tv_clear(&tvkey);
if (**arg == '}')
break;