mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 00:46:30 +00:00
vim-patch:8.2.0937: asan failure in the flatten() test
Problem: Asan failure in the flatten() test.
Solution: Free the flattened list.
dcf59c37d0
This commit is contained in:
@@ -651,6 +651,7 @@ int tv_list_flatten(list_T *list, long maxdepth)
|
|||||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
listitem_T *item;
|
listitem_T *item;
|
||||||
|
listitem_T *to_free;
|
||||||
int n;
|
int n;
|
||||||
if (maxdepth == 0) {
|
if (maxdepth == 0) {
|
||||||
return OK;
|
return OK;
|
||||||
@@ -668,12 +669,15 @@ int tv_list_flatten(list_T *list, long maxdepth)
|
|||||||
|
|
||||||
tv_list_drop_items(list, item, item);
|
tv_list_drop_items(list, item, item);
|
||||||
tv_list_extend(list, item->li_tv.vval.v_list, next);
|
tv_list_extend(list, item->li_tv.vval.v_list, next);
|
||||||
|
tv_clear(&item->li_tv);
|
||||||
|
to_free = item;
|
||||||
|
|
||||||
if (item->li_prev == NULL) {
|
if (item->li_prev == NULL) {
|
||||||
item = list->lv_first;
|
item = list->lv_first;
|
||||||
} else {
|
} else {
|
||||||
item = item->li_prev->li_next;
|
item = item->li_prev->li_next;
|
||||||
}
|
}
|
||||||
|
xfree(to_free);
|
||||||
|
|
||||||
if (++n >= maxdepth) {
|
if (++n >= maxdepth) {
|
||||||
n = 0;
|
n = 0;
|
||||||
|
Reference in New Issue
Block a user