8000 Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543) · python/cpython@4c596d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c596d5

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
"single" needs to be decrefed if PyList_Append() fails.
1 parent 01de89c commit 4c596d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Modules/socketmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6370,9 +6370,11 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
63706370
if (single == NULL)
63716371
goto err;
63726372

6373-
if (PyList_Append(all, single))
6373+
if (PyList_Append(all, single)) {
6374+
Py_DECREF(single);
63746375
goto err;
6375-
Py_XDECREF(single);
6376+
}
6377+
Py_DECREF(single);
63766378
}
63776379
Py_XDECREF(idna);
63786380
if (res0)

0 commit comments

Comments
 (0)
0