Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: net/base/x509_certificate_nss.cc

Issue 8919020: This fixes a bug I introduced last night (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/cert_database_nss.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « net/base/cert_database_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698