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

Skip to content

Commit 2b6e77e

Browse files
Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
"single" needs to be decrefed if PyList_Append() fails. (cherry picked from commit 4c596d5) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 10a8e11 commit 2b6e77e

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
@@ -6075,9 +6075,11 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
60756075
if (single == NULL)
60766076
goto err;
60776077

6078-
if (PyList_Append(all, single))
6078+
if (PyList_Append(all, single)) {
6079+
Py_DECREF(single);
60796080
goto err;
6080-
Py_XDECREF(single);
6081+
}
6082+
Py_DECREF(single);
60816083
}
60826084
Py_XDECREF(idna);
60836085
if (res0)

0 commit comments

Comments
 (0)
0