summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-26 16:42:23 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-26 16:42:23 +0000
commitf3980dc5d0a5f873cf764b8ba3e567e42259e4e5 (patch)
treecc57391efaa80338fa54ad82139456b19f82e431 /src/list.c
parent347538fad0c503249ebdedd5884c2081257c9f61 (diff)
downloadvim-git-f3980dc5d0a5f873cf764b8ba3e567e42259e4e5.tar.gz
patch 8.2.4632: using freed memory in flatten()v8.2.4632
Problem: Using freed memory in flatten(). Solution: Clear typval after recursing into list.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/list.c b/src/list.c
index 3354068a4..666fb5ad6 100644
--- a/src/list.c
+++ b/src/list.c
@@ -953,12 +953,12 @@ list_flatten(list_T *list, listitem_T *first, long maxitems, long maxdepth)
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);
}