]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.0937: asan failure in the flatten() test v8.2.0937
authorBram Moolenaar <Bram@vim.org>
Tue, 9 Jun 2020 15:30:04 +0000 (17:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 9 Jun 2020 15:30:04 +0000 (17:30 +0200)
Problem:    Asan failure in the flatten() test.
Solution:   Free the flattened list.

src/list.c
src/version.c

index de802e6cf25aa97ab1d182152bc0c555a374f86f..675cf4283b3aabc3f32305e9051f2128e3055ade 100644 (file)
@@ -739,6 +739,7 @@ list_insert(list_T *l, listitem_T *ni, listitem_T *item)
 list_flatten(list_T *list, long maxdepth)
 {
     listitem_T *item;
+    listitem_T *tofree;
     int                n;
 
     if (maxdepth == 0)
@@ -760,11 +761,14 @@ list_flatten(list_T *list, long maxdepth)
            vimlist_remove(list, item, item);
            if (list_extend(list, item->li_tv.vval.v_list, next) == FAIL)
                return FAIL;
+           clear_tv(&item->li_tv);
+           tofree = item;
 
            if (item->li_prev == NULL)
                item = list->lv_first;
            else
                item = item->li_prev->li_next;
+           list_free_item(list, tofree);
 
            if (++n >= maxdepth)
            {
index 37a43aafbc08ffb34fd6331d0d74b02315b67cdb..922ab4605e556e35b9af8feb75be5d45ff52964c 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    937,
 /**/
     936,
 /**/