aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Barreteau <>2020-06-30 18:45:58 +0200
committerCédric Barreteau <>2020-07-15 20:27:20 +0200
commitfd57d69970e7947da0d69d744c13121668f91bd8 (patch)
tree6afffe9074169424b1151b359cf2c015a19b980c /src
parent6420615e3f703870ed898083f84d6e3515a8c279 (diff)
downloadrneovim-fd57d69970e7947da0d69d744c13121668f91bd8.tar.gz
rneovim-fd57d69970e7947da0d69d744c13121668f91bd8.tar.bz2
rneovim-fd57d69970e7947da0d69d744c13121668f91bd8.zip
vim-patch:8.2.0937: asan failure in the flatten() test
Problem: Asan failure in the flatten() test. Solution: Free the flattened list. https://github.com/vim/vim/commit/dcf59c37d0e1517439c4c0c4a6a5ca09c90157ad
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/typval.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 576948f052..d5db15afcc 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -651,6 +651,7 @@ int tv_list_flatten(list_T *list, long maxdepth)
FUNC_ATTR_WARN_UNUSED_RESULT
{
listitem_T *item;
+ listitem_T *to_free;
int n;
if (maxdepth == 0) {
return OK;
@@ -668,12 +669,15 @@ int tv_list_flatten(list_T *list, long maxdepth)
tv_list_drop_items(list, item, item);
tv_list_extend(list, item->li_tv.vval.v_list, next);
+ tv_clear(&item->li_tv);
+ to_free = item;
if (item->li_prev == NULL) {
item = list->lv_first;
} else {
item = item->li_prev->li_next;
}
+ xfree(to_free);
if (++n >= maxdepth) {
n = 0;