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

Side by Side Diff: net/socket/ssl_client_socket_nss.cc

Issue 8308009: Fix a potential CFRelease(NULL). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived
6 // from AuthCertificateCallback() in 6 // from AuthCertificateCallback() in
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp.
8 8
9 /* ***** BEGIN LICENSE BLOCK ***** 9 /* ***** BEGIN LICENSE BLOCK *****
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
(...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 if (!nss_cert) { 2376 if (!nss_cert) {
2377 // In the event of an NSS error we make up an OS error and reuse 2377 // In the event of an NSS error we make up an OS error and reuse
2378 // the error handling, below. 2378 // the error handling, below.
2379 os_error = errSecCreateChainFailed; 2379 os_error = errSecCreateChainFailed;
2380 break; 2380 break;
2381 } 2381 }
2382 CERT_AddCertToListTail(*result_certs, nss_cert); 2382 CERT_AddCertToListTail(*result_certs, nss_cert);
2383 } 2383 }
2384 } 2384 }
2385 if (os_error == noErr) { 2385 if (os_error == noErr) {
2386 int cert_count = CFArrayGetCount(chain); 2386 int cert_count = 0;
2387 CFRelease(chain); 2387 if (chain) {
2388 CFArrayGetCount(chain);
Ryan Sleevi 2011/10/25 00:14:16 nico: Unchecked commit box. Now, |cert_count| is n
2389 CFRelease(chain);
2390 }
2388 that->net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED, 2391 that->net_log_.AddEvent(NetLog::TYPE_SSL_CLIENT_CERT_PROVIDED,
2389 make_scoped_refptr(new NetLogIntegerParameter("cert_count", 2392 make_scoped_refptr(new NetLogIntegerParameter("cert_count",
2390 cert_count))); 2393 cert_count)));
2391 return SECSuccess; 2394 return SECSuccess;
2392 } 2395 }
2393 LOG(WARNING) << "Client cert found, but could not be used: " 2396 LOG(WARNING) << "Client cert found, but could not be used: "
2394 << os_error; 2397 << os_error;
2395 if (*result_certs) { 2398 if (*result_certs) {
2396 CERT_DestroyCertList(*result_certs); 2399 CERT_DestroyCertList(*result_certs);
2397 *result_certs = NULL; 2400 *result_certs = NULL;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 valid_thread_id_ = base::PlatformThread::CurrentId(); 2596 valid_thread_id_ = base::PlatformThread::CurrentId();
2594 } 2597 }
2595 2598
2596 bool SSLClientSocketNSS::CalledOnValidThread() const { 2599 bool SSLClientSocketNSS::CalledOnValidThread() const {
2597 EnsureThreadIdAssigned(); 2600 EnsureThreadIdAssigned();
2598 base::AutoLock auto_lock(lock_); 2601 base::AutoLock auto_lock(lock_);
2599 return valid_thread_id_ == base::PlatformThread::CurrentId(); 2602 return valid_thread_id_ == base::PlatformThread::CurrentId();
2600 } 2603 }
2601 2604
2602 } // namespace net 2605 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698