summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2016-07-31 13:46:20 +0200
committerAlex Gaynor <alex.gaynor@gmail.com>2016-07-31 07:46:20 -0400
commit8a2dd77c1552b57c212859b1fe81079d5df1d4b4 (patch)
tree3afadd9eab258524c8903b419f2b6a565a9ed55b
parent72d968b2dea6937c2e2b1fe62bf404b667a98a80 (diff)
downloadpyopenssl-8a2dd77c1552b57c212859b1fe81079d5df1d4b4.tar.gz
Add guard for allocations failure of X509 objects (#507)
-rw-r--r--src/OpenSSL/crypto.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index c37f20b..c31a9d2 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -982,10 +982,9 @@ class X509(object):
"""
An X.509 certificate.
"""
-
def __init__(self):
- # TODO Allocation failure? And why not __new__ instead of __init__?
x509 = _lib.X509_new()
+ _openssl_assert(x509 != _ffi.NULL)
self._x509 = _ffi.gc(x509, _lib.X509_free)
def set_version(self, version):