summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-11-14 22:39:01 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-11-14 22:39:01 (GMT)
commit4c596d54aa6a55e9d2a3db78891e656ebbfb63c8 (patch)
tree2f39bae0ddccf5eb6696af1a030dd9fa227bb3d4 /Modules/socketmodule.c
parent01de89cb59107d4f889aa503a1c0350dae4aebaf (diff)
downloadcpython-4c596d54aa6a55e9d2a3db78891e656ebbfb63c8.zip
cpython-4c596d54aa6a55e9d2a3db78891e656ebbfb63c8.tar.gz
cpython-4c596d54aa6a55e9d2a3db78891e656ebbfb63c8.tar.bz2
Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
"single" needs to be decrefed if PyList_Append() fails.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 9149641..a47f031 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)