summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-07-14 05:19:18 (GMT)
committerGitHub <noreply@github.com>2021-07-14 05:19:18 (GMT)
commitf572cbf1faab33d9afbbe3e95738ed6fbe6e48e6 (patch)
treed03a1b3e8bb70c75a1f0a7e3cdeaaf419ed05db6 /Modules/_tkinter.c
parent81989058de381108dfd0a4255b93d4fb34417002 (diff)
downloadcpython-f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6.zip
cpython-f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6.tar.gz
cpython-f572cbf1faab33d9afbbe3e95738ed6fbe6e48e6.tar.bz2
bpo-44608: Fix memory leak in _tkinter._flatten() (GH-27107)
if it is called with a sequence or set, but not list or tuple.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 14101d9..329b291 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -3197,8 +3197,10 @@ _tkinter__flatten(PyObject *module, PyObject *item)
context.size = 0;
- if (!_flatten1(&context, item,0))
+ if (!_flatten1(&context, item, 0)) {
+ Py_XDECREF(context.tuple);
return NULL;
+ }
if (_PyTuple_Resize(&context.tuple, context.size))
return NULL;