mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4632: using freed memory in flatten()
Problem: Using freed memory in flatten().
Solution: Clear typval after recursing into list.
f3980dc5d0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
ec25572367
commit
c76dfe14b1
@ -682,13 +682,13 @@ void tv_list_flatten(list_T *list, listitem_T *first, long maxitems, long maxdep
|
|||||||
|
|
||||||
tv_list_drop_items(list, item, item);
|
tv_list_drop_items(list, item, item);
|
||||||
tv_list_extend(list, itemlist, next);
|
tv_list_extend(list, itemlist, next);
|
||||||
tv_clear(&item->li_tv);
|
|
||||||
|
|
||||||
if (maxdepth > 0) {
|
if (maxdepth > 0) {
|
||||||
tv_list_flatten(list,
|
tv_list_flatten(list,
|
||||||
item->li_prev == NULL ? list->lv_first : item->li_prev->li_next,
|
item->li_prev == NULL ? list->lv_first : item->li_prev->li_next,
|
||||||
itemlist->lv_len, maxdepth - 1);
|
itemlist->lv_len, maxdepth - 1);
|
||||||
}
|
}
|
||||||
|
tv_clear(&item->li_tv);
|
||||||
xfree(item);
|
xfree(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user