mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-139748: fix leaks in AC error paths when using unicode FS-b… (#139789)
* [3.14] gh-139748: fix leaks in AC error paths when using unicode FS-based converters (GH-139765)
(cherry picked from commit b04a57deef)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
077652b44f
commit
90cd009209
14 changed files with 88 additions and 46 deletions
|
|
@ -7261,7 +7261,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.
|
||||
|
|
@ -7269,7 +7269,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;
|
||||
|
|
@ -7278,7 +7278,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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue