mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
74947203af
commit
8b67c8f8c6
@ -5746,13 +5746,13 @@ static int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate)
|
|||||||
goto failret;
|
goto failret;
|
||||||
}
|
}
|
||||||
item = tv_dict_item_alloc((const char *)key);
|
item = tv_dict_item_alloc((const char *)key);
|
||||||
tv_clear(&tvkey);
|
|
||||||
item->di_tv = tv;
|
item->di_tv = tv;
|
||||||
item->di_tv.v_lock = 0;
|
item->di_tv.v_lock = 0;
|
||||||
if (tv_dict_add(d, item) == FAIL) {
|
if (tv_dict_add(d, item) == FAIL) {
|
||||||
tv_dict_item_free(item);
|
tv_dict_item_free(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tv_clear(&tvkey);
|
||||||
|
|
||||||
if (**arg == '}')
|
if (**arg == '}')
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user