mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
vim-patch:9.0.0204: indexof() may leak memory
Problem: indexof() may leak memory.
Solution: Free allocated values. (Yegappan Lakshmanan, closes vim/vim#10916)
63acae13f5
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -3505,6 +3505,7 @@ static varnumber_T indexof_eval_expr(typval_T *expr)
|
||||
|
||||
bool error = false;
|
||||
varnumber_T found = tv_get_bool_chk(&newtv, &error);
|
||||
tv_clear(&newtv);
|
||||
|
||||
return error ? false : found;
|
||||
}
|
||||
@@ -3566,7 +3567,10 @@ static varnumber_T indexof_list(list_T *l, varnumber_T startidx, typval_T *expr)
|
||||
set_vim_var_nr(VV_KEY, idx);
|
||||
tv_copy(TV_LIST_ITEM_TV(item), get_vim_var_tv(VV_VAL));
|
||||
|
||||
if (indexof_eval_expr(expr)) {
|
||||
bool found = indexof_eval_expr(expr);
|
||||
tv_clear(get_vim_var_tv(VV_VAL));
|
||||
|
||||
if (found) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user