Alexander Belopolsky added the comment:
It looks like non-windows code has a similar problem:
static PyObject *
posix_2str(PyObject *args,
char *format,
int (*func)(const char *, const char *))
{
char *path1 = NULL, *path2 = NULL;
int res;
if (!PyArg_ParseTuple(args, format,
Py_FileSystemDefaultEncoding, &path1,
Py_FileSystemDefaultEncoding, &path2))
return NULL;
If decoding of path2 fails, path1 is never freed.
On the patch itself, arguably Py_XDECREF(o2) is not necessary, but
leaving it in is probably good defensive programming (e.g. if more args
are added in the future.) I am +1 on the patch as is.
Please add a unit test that exercises the new code. Check that the leak
is detected when the unit test is ran with gc.set_debug(gc.DEBUG_LEAK).
----------
nosy: +belopolsky
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2222>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com