summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-11-14 15:39:01 -0700
committerSerhiy Storchaka <storchaka@gmail.com>2018-11-15 00:39:01 +0200
commit4c596d54aa6a55e9d2a3db78891e656ebbfb63c8 (patch)
tree2f39bae0ddccf5eb6696af1a030dd9fa227bb3d4 /Modules/socketmodule.c
parent01de89cb59107d4f889aa503a1c0350dae4aebaf (diff)
downloadcpython-git-4c596d54aa6a55e9d2a3db78891e656ebbfb63c8.tar.gz
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 9149641fce..a47f031460 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)