Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure

This commit is contained in:
Victor Stinner 2013-10-31 16:35:38 +01:00
parent e75996a77c
commit a9eb38f02a
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}