From 94d2c0da730705a1b01d0477f6ca56605eb50eaa Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 25 Sep 2018 11:02:18 +0300 Subject: [PATCH] bpo-34794: Fix a memory leak in Tkinter.Image. A Tcl object was leaked when set the data or maskdata options. --- .../next/Library/2018-09-25-11-04-12.bpo-34794.HGyLx-.rst | 2 ++ Modules/_tkinter.c | 1 + 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2018-09-25-11-04-12.bpo-34794.HGyLx-.rst diff --git a/Misc/NEWS.d/next/Library/2018-09-25-11-04-12.bpo-34794.HGyLx-.rst b/Misc/NEWS.d/next/Library/2018-09-25-11-04-12.bpo-34794.HGyLx-.rst new file mode 100644 index 00000000000000..c58a37b10b8f04 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-09-25-11-04-12.bpo-34794.HGyLx-.rst @@ -0,0 +1,2 @@ +Fixed a memory leak in :class:`Tkinter.Image` when set the *data* or +*maskdata* options. diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index c71ffd016ad881..9b8a4044803290 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3230,6 +3230,7 @@ Tkapp_CreateByteArray(PyObject *self, PyObject *args) return Tkinter_Error(self); } res = newPyTclObject(obj); + Tcl_DecrRefCount(obj); PyBuffer_Release(&view); return res; }