Skip to content

Commit

Permalink
bpo-32710: Fix leak in Overlapped_WSASend() (pythonGH-11469)
Browse files Browse the repository at this point in the history
Fix a memory leak in asyncio in the ProactorEventLoop when ReadFile()
or WSASend() overlapped operation fail immediately: release the
internal buffer.
  • Loading branch information
vstinner authored Jan 8, 2019
1 parent 872bd2b commit a234e14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions Modules/overlapped.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a234e14

Please sign in to comment.