mirror of
https://github.com/python/cpython.git
synced 2026-04-14 15:50:50 +00:00
[3.14] gh-146245: Fix reference and buffer leaks via audit hook in socket module (GH-146248) (GH-146274)
(cherry picked from commit c30fae4bea)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
This commit is contained in:
parent
796513306f
commit
69a37be21c
2 changed files with 3 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
Fixed reference leaks in :mod:`socket` when audit hooks raise exceptions in :func:`socket.getaddrinfo` and :meth:`!socket.sendto`.
|
||||
|
|
@ -4795,6 +4795,7 @@ sock_sendto(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
if (PySys_Audit("socket.sendto", "OO", s, addro) < 0) {
|
||||
PyBuffer_Release(&pbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -6965,7 +6966,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
|
|||
|
||||
if (PySys_Audit("socket.getaddrinfo", "OOiii",
|
||||
hobj, pobj, family, socktype, protocol) < 0) {
|
||||
return NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue