summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-05-10 22:27:00 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-05-10 22:27:00 (GMT)
commita6bb9849735e859067227f66963a6c345a0a1c72 (patch)
tree70d0c33cb503d5b3009f084bc9035592879e0430 /Modules/posixmodule.c
parentb2f073c39b1eae2cf9747e060db414b3a259700d (diff)
downloadcpython-a6bb9849735e859067227f66963a6c345a0a1c72.zip
cpython-a6bb9849735e859067227f66963a6c345a0a1c72.tar.gz
cpython-a6bb9849735e859067227f66963a6c345a0a1c72.tar.bz2
Issue #5990: fix memory leak introduced by PEP 383 commits
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 21dcb4d..ad4fff0 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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