From: Zackery Spytz Date: Wed, 14 Nov 2018 22:39:01 +0000 (-0700) Subject: Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543) X-Git-Tag: v3.8.0a1~493 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c596d54aa6a55e9d2a3db78891e656ebbfb63c8;p=thirdparty%2FPython%2Fcpython.git Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543) "single" needs to be decrefed if PyList_Append() fails. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 9149641fce5a..a47f0314605c 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -6370,9 +6370,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)