[Python-checkins] Revert "gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)" (#101238)

kumaraditya303 webhook-mailer at python.org
Sun Jan 22 03:47:07 EST 2023


https://github.com/python/cpython/commit/b53bad6dd08db78f5b5e2f41bea69c4b657fca13
commit: b53bad6dd08db78f5b5e2f41bea69c4b657fca13
branch: main
author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2023-01-22T14:17:01+05:30
summary:

Revert "gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)" (#101238)

Revert "gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)"

This reverts commit 5f08fe4a2c055880c23c6f9b57ff03005d193bfc.

files:
D Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst
M Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst b/Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst
deleted file mode 100644
index beec5c9e57f6..000000000000
--- a/Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Avoid unexpected ``freeaddrinfo`` when :meth:`socket.socket.getaddrinfo`
-fails. Patch by Sergey G. Brester.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 8659d725f2e3..4747a23e8317 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -6719,7 +6719,6 @@ 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;
     }
@@ -6816,7 +6815,6 @@ 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;
     }



More information about the Python-checkins mailing list