Skip to content

Commit 88ad48b

Browse files
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. (cherry picked from commit a234e14) Co-authored-by: Victor Stinner <[email protected]>
1 parent 69f64b6 commit 88ad48b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a memory leak in asyncio in the ProactorEventLoop when ``ReadFile()`` or
2+
``WSASend()`` overlapped operation fail immediately: release the internal
3+
buffer.

Modules/overlapped.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ do_ReadFile(OverlappedObject *self, HANDLE handle,
723723
case ERROR_IO_PENDING:
724724
Py_RETURN_NONE;
725725
default:
726+
PyBuffer_Release(&self->user_buffer);
726727
self->type = TYPE_NOT_STARTED;
727728
return SetFromWindowsErr(err);
728729
}
@@ -1011,6 +1012,7 @@ Overlapped_WSASend(OverlappedObject *self, PyObject *args)
10111012
case ERROR_IO_PENDING:
10121013
Py_RETURN_NONE;
10131014
default:
1015+
PyBuffer_Release(&self->user_buffer);
10141016
self->type = TYPE_NOT_STARTED;
10151017
return SetFromWindowsErr(err);
10161018
}

0 commit comments

Comments
 (0)