Skip to content

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 <[email protected]>
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)