]> granicus.if.org Git - python/commitdiff
Issue #5990: fix memory leak introduced by PEP 383 commits
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 10 May 2009 22:27:00 +0000 (22:27 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 10 May 2009 22:27:00 +0000 (22:27 +0000)
Modules/posixmodule.c

index 21dcb4d963845f27e070143420fc6e020b7a18da..ad4fff0c78a9115be2135fd8d152fa67e0330b86 100644 (file)
@@ -784,13 +784,16 @@ posix_2str(PyObject *args,
           char *format,
           int (*func)(const char *, const char *))
 {
-       PyObject *opath1, *opath2;
+       PyObject *opath1 = NULL, *opath2 = NULL;
        char *path1, *path2;
        int res;
        if (!PyArg_ParseTuple(args, format,
                              PyUnicode_FSConverter, &opath1,
-                             PyUnicode_FSConverter, &opath2))
+                             PyUnicode_FSConverter, &opath2)) {
+               Py_XDECREF(opath1);
+               Py_XDECREF(opath2);
                return NULL;
+       }
        path1 = bytes2str(opath1, 1);
        path2 = bytes2str(opath2, 1);
        Py_BEGIN_ALLOW_THREADS