mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-32710: Fix leak in Overlapped_WSASend() (GH-11469)
Fix a memory leak in asyncio in the ProactorEventLoop when ReadFile() or WSASend() overlapped operation fail immediately: release the internal buffer.
This commit is contained in:
parent
872bd2b57c
commit
a234e14839
2 changed files with 5 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
Fix a memory leak in asyncio in the ProactorEventLoop when ``ReadFile()`` or
|
||||
``WSASend()`` overlapped operation fail immediately: release the internal
|
||||
buffer.
|
||||
|
|
@ -723,6 +723,7 @@ do_ReadFile(OverlappedObject *self, HANDLE handle,
|
|||
case ERROR_IO_PENDING:
|
||||
Py_RETURN_NONE;
|
||||
default:
|
||||
PyBuffer_Release(&self->user_buffer);
|
||||
self->type = TYPE_NOT_STARTED;
|
||||
return SetFromWindowsErr(err);
|
||||
}
|
||||
|
|
@ -1011,6 +1012,7 @@ Overlapped_WSASend(OverlappedObject *self, PyObject *args)
|
|||
case ERROR_IO_PENDING:
|
||||
Py_RETURN_NONE;
|
||||
default:
|
||||
PyBuffer_Release(&self->user_buffer);
|
||||
self->type = TYPE_NOT_STARTED;
|
||||
return SetFromWindowsErr(err);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue