patch 8.2.4632: using freed memory in flatten()
Problem: Using freed memory in flatten().
Solution: Clear typval after recursing into list.
diff --git a/src/list.c b/src/list.c
index 3354068..666fb5a 100644
--- a/src/list.c
+++ b/src/list.c
@@ -953,12 +953,12 @@
list_free_item(list, item);
return;
}
- clear_tv(&item->li_tv);
if (maxdepth > 0)
list_flatten(list, item->li_prev == NULL
? list->lv_first : item->li_prev->li_next,
itemlist->lv_len, maxdepth - 1);
+ clear_tv(&item->li_tv);
list_free_item(list, item);
}