mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
gh-100795: avoid unexpected freeaddrinfo
after failed getaddrinfo
(#101220)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
This commit is contained in:
parent
95f5b05a8c
commit
5f08fe4a2c
2 changed files with 4 additions and 0 deletions
|
@ -6719,6 +6719,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
|
|||
error = getaddrinfo(hptr, pptr, &hints, &res0);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (error) {
|
||||
res0 = NULL; /* avoid unexpected free if res0 becomes not NULL */
|
||||
set_gaierror(error);
|
||||
goto err;
|
||||
}
|
||||
|
@ -6815,6 +6816,7 @@ socket_getnameinfo(PyObject *self, PyObject *args)
|
|||
error = getaddrinfo(hostp, pbuf, &hints, &res);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (error) {
|
||||
res = NULL; /* avoid unexpected free if res becomes not NULL */
|
||||
set_gaierror(error);
|
||||
goto fail;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue