Skip to content

Commit

Permalink
Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
Browse files Browse the repository at this point in the history
"single" needs to be decrefed if PyList_Append() fails.
  • Loading branch information
ZackerySpytz authored and serhiy-storchaka committed Nov 14, 2018
1 parent 01de89c commit 4c596d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Modules/socketmodule.c
Expand Up @@ -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)
Expand Down

0 comments on commit 4c596d5

Please sign in to comment.