[Python-checkins] python/dist/src/Modules _tkinter.c,1.159,1.160
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Wed, 28 May 2003 17:17:06 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv22503/Modules
Modified Files:
_tkinter.c
Log Message:
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.
Index: _tkinter.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -C2 -d -r1.159 -r1.160
*** _tkinter.c 19 May 2003 19:57:42 -0000 1.159
--- _tkinter.c 29 May 2003 00:17:03 -0000 1.160
***************
*** 1885,1893 ****
return NULL;
! if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR)
return Tkinter_Error(self);
if (!(v = PyTuple_New(argc)))
! return NULL;
for (i = 0; i < argc; i++) {
--- 1885,1896 ----
return NULL;
! if (Tcl_SplitList(Tkapp_Interp(self), list,
! &argc, &argv) == TCL_ERROR) {
! PyMem_Free(list);
return Tkinter_Error(self);
+ }
if (!(v = PyTuple_New(argc)))
! goto finally;
for (i = 0; i < argc; i++) {
***************
*** 1902,1905 ****
--- 1905,1909 ----
finally:
ckfree(FREECAST argv);
+ PyMem_Free(list);
return v;
}
***************
*** 1908,1911 ****
--- 1912,1916 ----
Tkapp_Split(PyObject *self, PyObject *args)
{
+ PyObject *v;
char *list;
***************
*** 1919,1923 ****
if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list))
return NULL;
! return Split(list);
}
--- 1924,1930 ----
if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list))
return NULL;
! v = Split(list);
! PyMem_Free(list);
! return v;
}