Add a few more error checks around OpenSSL API calls.

These errors can only occur in low memory conditions, so there
is no reasonable way to test them.
diff --git a/OpenSSL/crypto/crypto.c b/OpenSSL/crypto/crypto.c
index b0e0d2f..d642dc6 100644
--- a/OpenSSL/crypto/crypto.c
+++ b/OpenSSL/crypto/crypto.c
@@ -143,6 +143,10 @@
     }
 
     bio = BIO_new_mem_buf(buffer, len);
+    if (bio == NULL) {
+        exception_from_error_queue(crypto_Error);
+        return NULL;
+    }
     switch (type)
     {
         case X509_FILETYPE_PEM:
@@ -220,6 +224,10 @@
     }
 
     bio = BIO_new(BIO_s_mem());
+    if (bio == NULL) {
+        exception_from_error_queue(crypto_Error);
+        return NULL;
+    }
     switch (type)
     {
         case X509_FILETYPE_PEM:
@@ -232,6 +240,10 @@
 
         case X509_FILETYPE_TEXT:
             rsa = EVP_PKEY_get1_RSA(pkey->pkey);
+            if (rsa == NULL) {
+                ret = 0;
+                break;
+            }
             ret = RSA_print(bio, rsa, 0);
             RSA_free(rsa);
             break;