Index: net/base/x509_certificate_openssl.cc |
diff --git a/net/base/x509_certificate_openssl.cc b/net/base/x509_certificate_openssl.cc |
index 43198dc76c1879660766785bf0a63248732fd537..18afa5838968657efdd9fd5dc900e2fc9c07eb20 100644 |
--- a/net/base/x509_certificate_openssl.cc |
+++ b/net/base/x509_certificate_openssl.cc |
@@ -440,8 +440,14 @@ bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, |
void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, |
size_t* size_bits, |
PublicKeyType* type) { |
+ *type = kPublicKeyTypeUnknown; |
+ *size_bits = 0; |
+ |
crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> scoped_key( |
X509_get_pubkey(cert_handle)); |
+ if (!scoped_key.get()) |
+ return; |
+ |
CHECK(scoped_key.get()); |
EVP_PKEY* key = scoped_key.get(); |
@@ -462,10 +468,6 @@ void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, |
*type = kPublicKeyTypeDH; |
*size_bits = EVP_PKEY_size(key) * 8; |
break; |
- default: |
- *type = kPublicKeyTypeUnknown; |
- *size_bits = 0; |
- break; |
} |
} |