summaryrefslogtreecommitdiff
path: root/src/if_py_both.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-21 19:12:47 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-21 19:12:47 +0100
commit21578271bb717f7ab7b8728e9efa54c3b60ee7e4 (patch)
treebc84fb32dacad216019810d5702e13aca8d83133 /src/if_py_both.h
parent027c4ab4d2e3ff031b98e0fb648f5acbea180293 (diff)
downloadvim-git-21578271bb717f7ab7b8728e9efa54c3b60ee7e4.tar.gz
patch 8.2.2538: crash when using Python list iteratorv8.2.2538
Problem: Crash when using Python list iterator. Solution: Increment the list reference count. (closes #7886)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 2903b0ba9..9dbff1cbf 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -2815,6 +2815,7 @@ typedef struct
ListIterDestruct(listiterinfo_T *lii)
{
list_rem_watch(lii->list, &lii->lw);
+ list_unref(lii->list);
PyMem_Free(lii);
}
@@ -2850,6 +2851,7 @@ ListIter(ListObject *self)
list_add_watch(l, &lii->lw);
lii->lw.lw_item = l->lv_first;
lii->list = l;
+ ++l->lv_refcount;
return IterNew(lii,
(destructorfun) ListIterDestruct, (nextfun) ListIterNext,