summaryrefslogtreecommitdiff
path: root/OpenSSL/ssl/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSSL/ssl/context.c')
-rw-r--r--OpenSSL/ssl/context.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/OpenSSL/ssl/context.c b/OpenSSL/ssl/context.c
index 0b9f4b6..e971c0a 100644
--- a/OpenSSL/ssl/context.c
+++ b/OpenSSL/ssl/context.c
@@ -1249,7 +1249,7 @@ ssl_Context_init(ssl_ContextObj *self, int i_method) {
#ifdef OPENSSL_NO_SSL2
PyErr_SetString(PyExc_ValueError, "SSLv2_METHOD not supported by this version of OpenSSL");
return NULL;
-#else
+#else
method = SSLv2_method();
#endif
break;
@@ -1268,6 +1268,11 @@ ssl_Context_init(ssl_ContextObj *self, int i_method) {
}
self->ctx = SSL_CTX_new(method);
+ if (self->ctx == NULL) {
+ exception_from_error_queue(ssl_Error);
+ return NULL;
+ }
+
Py_INCREF(Py_None);
self->passphrase_callback = Py_None;
Py_INCREF(Py_None);