]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
authorZackery Spytz <zspytz@gmail.com>
Wed, 14 Nov 2018 22:39:01 +0000 (15:39 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 14 Nov 2018 22:39:01 +0000 (00:39 +0200)
"single" needs to be decrefed if PyList_Append() fails.

Modules/socketmodule.c

index 9149641fce5a22ec3140557af06ead538792ed0c..a47f0314605c2d11d64cc8c33b6939ec73d4b068 100644 (file)
@@ -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)