]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-32710: Fix leak in Overlapped_WSASend() (GH-11469)
authorVictor Stinner <vstinner@redhat.com>
Tue, 8 Jan 2019 13:23:09 +0000 (14:23 +0100)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 13:23:09 +0000 (14:23 +0100)
Fix a memory leak in asyncio in the ProactorEventLoop when ReadFile()
or WSASend() overlapped operation fail immediately: release the
internal buffer.

Misc/NEWS.d/next/Library/2019-01-08-14-00-52.bpo-32710.Sn5Ujj.rst [new file with mode: 0644]
Modules/overlapped.c

diff --git a/Misc/NEWS.d/next/Library/2019-01-08-14-00-52.bpo-32710.Sn5Ujj.rst b/Misc/NEWS.d/next/Library/2019-01-08-14-00-52.bpo-32710.Sn5Ujj.rst
new file mode 100644 (file)
index 0000000..5c3961c
--- /dev/null
@@ -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.
index 69875a7f37da5172705b72beaa053527845c932e..bbaa4fb3008f0979ed1d26b17ad075598946fe91 100644 (file)
@@ -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);
     }