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

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b5ea5e5

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 b6b56b4 commit b5ea5e5

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
@@ -6269,9 +6269,11 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
62696269
if (single == NULL)
62706270
goto err;
62716271

6272-
if (PyList_Append(all, single))
6272+
if (PyList_Append(all, single)) {
6273+
Py_DECREF(single);
62736274
goto err;
6274-
Py_XDECREF(single);
6275+
}
6276+
Py_DECREF(single);
62756277
}
62766278
Py_XDECREF(idna);
62776279
if (res0)

0 commit comments

Comments
 (0)
0