summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2003-05-29 00:17:03 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2003-05-29 00:17:03 (GMT)
commitd1c5510b997a1cf12dcc2619ba7b8663df5f4009 (patch)
tree85c3d03e0052ad0a1ebd8e717a5751897acc2254 /Modules/_tkinter.c
parent20b15bbc566cc3bb8640a795599119f493eebec6 (diff)
downloadcpython-d1c5510b997a1cf12dcc2619ba7b8663df5f4009.zip
cpython-d1c5510b997a1cf12dcc2619ba7b8663df5f4009.tar.gz
cpython-d1c5510b997a1cf12dcc2619ba7b8663df5f4009.tar.bz2
Fix SF #745055, Memory leak in _tkinter.c/Tkapp_SplitList()
Also fix a memory leak in Tkapp_Split. This needs to be backported. I'll leave it up to Barry whether this is for 2.2.3 or 2.2.4.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index fbc6ec1..5851372 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -1884,11 +1884,14 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "et:splitlist", "utf-8", &list))
return NULL;
- if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR)
+ if (Tcl_SplitList(Tkapp_Interp(self), list,
+ &argc, &argv) == TCL_ERROR) {
+ PyMem_Free(list);
return Tkinter_Error(self);
+ }
if (!(v = PyTuple_New(argc)))
- return NULL;
+ goto finally;
for (i = 0; i < argc; i++) {
PyObject *s = PyString_FromString(argv[i]);
@@ -1901,12 +1904,14 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
finally:
ckfree(FREECAST argv);
+ PyMem_Free(list);
return v;
}
static PyObject *
Tkapp_Split(PyObject *self, PyObject *args)
{
+ PyObject *v;
char *list;
if (PyTuple_Size(args) == 1) {
@@ -1918,7 +1923,9 @@ Tkapp_Split(PyObject *self, PyObject *args)
}
if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list))
return NULL;
- return Split(list);
+ v = Split(list);
+ PyMem_Free(list);
+ return v;
}
static PyObject *