This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, ocean-city
Date 2008-03-03.15:16:50
SpamBayes Score 2.3546314e-05
Marked as misclassified No
Message-id <1204557412.38.0.283176542337.issue2222@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2008-03-03 15:16:52belopolskysetspambayes_score: 2.35463e-05 -> 2.3546314e-05
recipients: + belopolsky, ocean-city
2008-03-03 15:16:52belopolskysetspambayes_score: 2.35463e-05 -> 2.35463e-05
messageid: <1204557412.38.0.283176542337.issue2222@psf.upfronthosting.co.za>
2008-03-03 15:16:51belopolskylinkissue2222 messages
2008-03-03 15:16:50belopolskycreate