8000 [3.11] gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (GH-101220) by miss-islington · Pull Request #101236 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.11] gh-100795: avoid unexpected freeaddrinfo after failed getaddrinfo (GH-101220) #101236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
8000
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Avoid unexpected ``freeaddrinfo`` when :meth:`socket.socket.getaddrinfo`
fails. Patch by Sergey G. Brester.
2 changes: 2 additions & 0 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6608,6 +6608,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;
}
Expand Down Expand Up @@ -6704,6 +6705,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;
}
Expand Down
0