diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index eeade2ecad6..ddb1c4364b9 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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)