summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-11-26 15:06:27 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-11-26 15:06:27 (GMT)
commitacaab2ae1c87299e10a82038764952ebcf5d1000 (patch)
tree0fda67b8043a90f5d4ab44aac98f254ce2c7177f /Modules
parent918c90ce06d6189f8d24d1dba842382a5cb447d4 (diff)
downloadcpython-acaab2ae1c87299e10a82038764952ebcf5d1000.zip
cpython-acaab2ae1c87299e10a82038764952ebcf5d1000.tar.gz
cpython-acaab2ae1c87299e10a82038764952ebcf5d1000.tar.bz2
Merged revisions 86804 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86804 | stefan.krah | 2010-11-26 13:58:05 +0100 (Fri, 26 Nov 2010) | 1 line Issue #10383: Fix two leaks. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8128418..d14c593 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6572,8 +6572,10 @@ posix_read(PyObject *self, PyObject *args)
buffer = PyString_FromStringAndSize((char *)NULL, size);
if (buffer == NULL)
return NULL;
- if (!_PyVerify_fd(fd))
+ if (!_PyVerify_fd(fd)) {
+ Py_DECREF(buffer);
return posix_error();
+ }
Py_BEGIN_ALLOW_THREADS
n = read(fd, PyString_AsString(buffer), size);
Py_END_ALLOW_THREADS
@@ -6600,12 +6602,14 @@ posix_write(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf))
return NULL;
- if (!_PyVerify_fd(fd))
+ if (!_PyVerify_fd(fd)) {
+ PyBuffer_Release(&pbuf);
return posix_error();
+ }
Py_BEGIN_ALLOW_THREADS
size = write(fd, pbuf.buf, (size_t)pbuf.len);
Py_END_ALLOW_THREADS
- PyBuffer_Release(&pbuf);
+ PyBuffer_Release(&pbuf);
if (size < 0)
return posix_error();
return PyInt_FromSsize_t(size);
@@ -7525,10 +7529,10 @@ posix_pathconf(PyObject *self, PyObject *args)
limit = pathconf(path, name);
if (limit == -1 && errno != 0) {
if (errno == EINVAL)
- /* could be a path or name problem */
- posix_error();
+ /* could be a path or name problem */
+ posix_error();
else
- posix_error_with_filename(path);
+ posix_error_with_filename(path);
}
else
result = PyInt_FromLong(limit);