[Python-checkins] Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
Serhiy Storchaka
webhook-mailer at python.org
Wed Nov 14 17:39:06 EST 2018
https://github.com/python/cpython/commit/4c596d54aa6a55e9d2a3db78891e656ebbfb63c8
commit: 4c596d54aa6a55e9d2a3db78891e656ebbfb63c8
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018年11月15日T00:39:01+02:00
summary:
Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
"single" needs to be decrefed if PyList_Append() fails.
files:
M Modules/socketmodule.c
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)
More information about the Python-checkins
mailing list