1
0
forked from aniani/vim

patch 8.2.4632: using freed memory in flatten()

Problem:    Using freed memory in flatten().
Solution:   Clear typval after recursing into list.
This commit is contained in:
Bram Moolenaar
2022-03-26 16:42:23 +00:00
parent 347538fad0
commit f3980dc5d0
2 changed files with 3 additions and 1 deletions

View File

@@ -953,12 +953,12 @@ list_flatten(list_T *list, listitem_T *first, long maxitems, long maxdepth)
list_free_item(list, item); list_free_item(list, item);
return; return;
} }
clear_tv(&item->li_tv);
if (maxdepth > 0) if (maxdepth > 0)
list_flatten(list, item->li_prev == NULL list_flatten(list, item->li_prev == NULL
? list->lv_first : item->li_prev->li_next, ? list->lv_first : item->li_prev->li_next,
itemlist->lv_len, maxdepth - 1); itemlist->lv_len, maxdepth - 1);
clear_tv(&item->li_tv);
list_free_item(list, item); list_free_item(list, item);
} }

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4632,
/**/ /**/
4631, 4631,
/**/ /**/