summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-08-16 04:56:11 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-08-16 04:56:11 (GMT)
commita853c479eeefb0c8a3a68291951db868593367cf (patch)
tree4233a9810a33cd162b53a47fc902a7c6fdde3f94
parentcc2e80be641238f48bdc6d53f09666c904fd17f7 (diff)
parent81b9ecd2a3338cad109c2827af423867e46c6808 (diff)
downloadcpython-a853c479eeefb0c8a3a68291951db868593367cf.zip
cpython-a853c479eeefb0c8a3a68291951db868593367cf.tar.gz
cpython-a853c479eeefb0c8a3a68291951db868593367cf.tar.bz2
merge 3.5 (#27773)
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_ssl.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 59fc57a..60a248b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -90,6 +90,8 @@ Library
- Issue #6422: Add autorange method to timeit.Timer objects.
+- Issue #27773: Correct some memory management errors server_hostname in _ssl.wrap_socket().
+
- Issue #26750: unittest.mock.create_autospec() now works properly for
subclasses of property() and other data descriptors. Removes the never
publicly used, never documented unittest.mock.DescriptorTypes tuple.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 8a4654a..e2c4386 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -487,7 +487,6 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
{
PySSLSocket *self;
SSL_CTX *ctx = sslctx->ctx;
- PyObject *hostname;
long mode;
self = PyObject_New(PySSLSocket, &PySSLSocket_Type);
@@ -501,16 +500,16 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
self->shutdown_seen_zero = 0;
self->handshake_done = 0;
self->owner = NULL;
+ self->server_hostname = NULL;
if (server_hostname != NULL) {
- hostname = PyUnicode_Decode(server_hostname, strlen(server_hostname),
- "idna", "strict");
+ PyObject *hostname = PyUnicode_Decode(server_hostname, strlen(server_hostname),
+ "idna", "strict");
if (hostname == NULL) {
Py_DECREF(self);
return NULL;
}
self->server_hostname = hostname;
- } else
- self->server_hostname = NULL;
+ }
Py_INCREF(sslctx);
@@ -563,7 +562,6 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
self->Socket = PyWeakref_NewRef((PyObject *) sock, NULL);
if (self->Socket == NULL) {
Py_DECREF(self);
- Py_XDECREF(self->server_hostname);
return NULL;
}
}