I ran 2.4.x through valgrind and found two small problems on Linux
that have been fixed. There may be some other issues which could
benefit from more eyes (small, probably one time memory leaks). The
entire run is here:
http://python.org/valgrind-2.4.2.out
(I need to write a lot more suppression rules for gentoo.)
I think I see a memory leak in win32_startfile. Since I don't run
windows I can't test it.
filepath should be allocated with the et flag to PyArgs_ParseTuple(),
but it wasn't freed without this patch. Does this make sense? See
the attached patch.
n
Index: Modules/posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.342
diff -w -u -u -8 -r2.342 posixmodule.c
--- Modules/posixmodule.c 19 Sep 2005 06:45:53 -0000 2.342
+++ Modules/posixmodule.c 19 Sep 2005 07:47:44 -0000
@@ -7250,18 +7250,22 @@
char *filepath;
HINSTANCE rc;
if (!PyArg_ParseTuple(args, "et:startfile",
Py_FileSystemDefaultEncoding, &filepath))
return NULL;
Py_BEGIN_ALLOW_THREADS
rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL);
Py_END_ALLOW_THREADS
- if (rc <= (HINSTANCE)32)
- return win32_error("startfile", filepath);
+ if (rc <= (HINSTANCE)32) {
+ PyObject *value = win32_error("startfile", filepath);
+ PyMem_Free(filepath);
+ return value;
+ }
+ PyMem_Free(filepath);
Py_INCREF(Py_None);
return Py_None;
}
#endif
#ifdef HAVE_GETLOADAVG
PyDoc_STRVAR(posix_getloadavg__doc__,
"getloadavg() -> (float, float, float)\n\n\
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com