From: Victor Stinner Date: Thu, 31 Oct 2013 15:35:38 +0000 (+0100) Subject: Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure X-Git-Tag: v3.4.0b1~449 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9eb38f02a7c0b5540da84cdf94ef4b56bef1716;p=thirdparty%2FPython%2Fcpython.git Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure --- diff --git a/Modules/_ssl.c b/Modules/_ssl.c index ffcc4a9f6129..83a271e23ebf 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; }