changeset 28213:183ae001d99d v8.2.4632

patch 8.2.4632: using freed memory in flatten() Commit: https://github.com/vim/vim/commit/f3980dc5d0a5f873cf764b8ba3e567e42259e4e5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 26 16:42:23 2022 +0000 patch 8.2.4632: using freed memory in flatten() Problem: Using freed memory in flatten(). Solution: Clear typval after recursing into list.
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Mar 2022 17:45:03 +0100
parents 35eab16cffae
children 77216ce30cef
files src/list.c src/version.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/list.c
+++ b/src/list.c
@@ -953,12 +953,12 @@ list_flatten(list_T *list, listitem_T *f
 		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);
 	}
 
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4632,
+/**/
     4631,
 /**/
     4630,