Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)

"single" needs to be decrefed if PyList_Append() fails.
(cherry picked from commit 4c596d54aa)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-11-15 01:25:34 -08:00 committed by GitHub
parent b6b56b49e9
commit b5ea5e57f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -6269,9 +6269,11 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
if (single == NULL)
goto err;
if (PyList_Append(all, single))
if (PyList_Append(all, single)) {
Py_DECREF(single);
goto err;
Py_XDECREF(single);
}
Py_DECREF(single);
}
Py_XDECREF(idna);
if (res0)