]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-32710: Fix leak in Overlapped_WSASend() (GH-11469)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 8 Jan 2019 13:40:50 +0000 (05:40 -0800)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 13:40:50 +0000 (05:40 -0800)
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 a234e148394c2c7419372ab65b773d53a57f3625)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
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 ae7cddadd02df73648250fefe108a8bb3c3ec5c5..4ef5a96b1e4d57fc570461537f587016f8159ffa 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);
     }