summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-31 15:35:38 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-31 15:35:38 (GMT)
commita9eb38f02a7c0b5540da84cdf94ef4b56bef1716 (patch)
tree4ae9775b171468e6c2ba3b54a721ae09a7159b48
parente75996a77ca1974ffa36f9b7be6cd9d3023c49e7 (diff)
downloadcpython-a9eb38f02a7c0b5540da84cdf94ef4b56bef1716.zip
cpython-a9eb38f02a7c0b5540da84cdf94ef4b56bef1716.tar.gz
cpython-a9eb38f02a7c0b5540da84cdf94ef4b56bef1716.tar.bz2
Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure
-rw-r--r--Modules/_ssl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index ffcc4a9..83a271e 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -528,6 +528,10 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
self->socket_type = socket_type;
self->Socket = PyWeakref_NewRef((PyObject *) sock, NULL);
+ if (self->Socket == NULL) {
+ Py_DECREF(self);
+ return NULL;
+ }
return self;
}