]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 31 Oct 2013 15:35:38 +0000 (16:35 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 31 Oct 2013 15:35:38 +0000 (16:35 +0100)
Modules/_ssl.c

index ffcc4a9f61290205ca381d6e436fc3d37f56c1ad..83a271e23ebf63dccd471dc89b6e35ee1742eac0 100644 (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;
 }