Chromium Code Reviews| Index: net/base/x509_certificate_nss.cc |
| diff --git a/net/base/x509_certificate_nss.cc b/net/base/x509_certificate_nss.cc |
| index af7172c69940e1857940253a6f9227c2b109452c..53f3851ad0bdca61acc7078213336fdf713f8b90 100644 |
| --- a/net/base/x509_certificate_nss.cc |
| +++ b/net/base/x509_certificate_nss.cc |
| @@ -714,19 +714,21 @@ std::string X509Certificate::GetDefaultNickname(CertType type) const { |
| // Find the private key for this certificate and see if it has a |
| // nickname. If there is a private key, and it has a nickname, then |
| // we return that nickname. |
| - SECKEYPrivateKey* private_key = PK11_FindPrivateKeyFromCert( |
| - cert_handle_->slot, |
| - cert_handle_, |
| - NULL); // wincx |
| - if (private_key) { |
| - char* private_key_nickname = PK11_GetPrivateKeyNickname(private_key); |
| - if (private_key_nickname) { |
| - result = private_key_nickname; |
| - PORT_Free(private_key_nickname); |
| + if (cert_handle_->slot) { |
|
wtc
2011/12/12 23:52:57
You can merge lines 713 and 717:
if (type == USE
|
| + SECKEYPrivateKey* private_key = PK11_FindPrivateKeyFromCert( |
| + cert_handle_->slot, |
| + cert_handle_, |
| + NULL); // wincx |
| + if (private_key) { |
| + char* private_key_nickname = PK11_GetPrivateKeyNickname(private_key); |
| + if (private_key_nickname) { |
| + result = private_key_nickname; |
| + PORT_Free(private_key_nickname); |
| + SECKEY_DestroyPrivateKey(private_key); |
| + return result; |
| + } |
| SECKEY_DestroyPrivateKey(private_key); |
| - return result; |
| } |
| - SECKEY_DestroyPrivateKey(private_key); |
| } |
| } |