mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
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. ........
This commit is contained in:
parent
918c90ce06
commit
acaab2ae1c
1 changed files with 10 additions and 6 deletions
|
@ -6572,8 +6572,10 @@ posix_read(PyObject *self, PyObject *args)
|
||||||
buffer = PyString_FromStringAndSize((char *)NULL, size);
|
buffer = PyString_FromStringAndSize((char *)NULL, size);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!_PyVerify_fd(fd))
|
if (!_PyVerify_fd(fd)) {
|
||||||
|
Py_DECREF(buffer);
|
||||||
return posix_error();
|
return posix_error();
|
||||||
|
}
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
n = read(fd, PyString_AsString(buffer), size);
|
n = read(fd, PyString_AsString(buffer), size);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
@ -6600,8 +6602,10 @@ posix_write(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf))
|
if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!_PyVerify_fd(fd))
|
if (!_PyVerify_fd(fd)) {
|
||||||
|
PyBuffer_Release(&pbuf);
|
||||||
return posix_error();
|
return posix_error();
|
||||||
|
}
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
size = write(fd, pbuf.buf, (size_t)pbuf.len);
|
size = write(fd, pbuf.buf, (size_t)pbuf.len);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue