gh-139748: fix leaks in AC error paths when using unicode FS-based converters (#139765)

This commit is contained in:
Bénédikt Tran 2025-10-08 17:22:44 +02:00 committed by GitHub
parent 570d17259f
commit b04a57deef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 88 additions and 46 deletions

View file

@ -7278,7 +7278,7 @@ Returns a list of network interface information (index, name) tuples.");
/*[clinic input]
_socket.if_nametoindex
oname: object(converter="PyUnicode_FSConverter")
oname: unicode_fs_encoded
/
Returns the interface index corresponding to the interface name if_name.
@ -7286,7 +7286,7 @@ Returns the interface index corresponding to the interface name if_name.
static PyObject *
_socket_if_nametoindex_impl(PyObject *module, PyObject *oname)
/*[clinic end generated code: output=289a411614f30244 input=01e0f1205307fb77]*/
/*[clinic end generated code: output=289a411614f30244 input=6125dc20683560cf]*/
{
#ifdef MS_WINDOWS
NET_IFINDEX index;
@ -7295,7 +7295,6 @@ _socket_if_nametoindex_impl(PyObject *module, PyObject *oname)
#endif
index = if_nametoindex(PyBytes_AS_STRING(oname));
Py_DECREF(oname);
if (index == 0) {
/* if_nametoindex() doesn't set errno */
PyErr_SetString(PyExc_OSError, "no interface with this name");