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

Unified Diff: runtime/bin/secure_socket.cc

Issue 12298035: Fix error handling in SecureSocket.initialize (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months 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 | « no previous file | tests/standalone/io/secure_socket_argument_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.cc
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index 603a4c0afed60030df59af20d9e08c1bc24fa49c..37640eb5cc997dbb2666173912ed1b07640112fb 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -340,7 +340,6 @@ void SSLFilter::InitializeLibrary(const char* certificate_database,
bool report_duplicate_initialization) {
MutexLocker locker(&mutex_);
if (!library_initialized_) {
- library_initialized_ = true;
password_ = strdup(password); // This one copy persists until Dart exits.
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
// TODO(whesse): Verify there are no UTF-8 issues here.
@@ -362,20 +361,25 @@ void SSLFilter::InitializeLibrary(const char* certificate_database,
SECMOD_DB,
init_flags);
if (status != SECSuccess) {
+ mutex_.Unlock(); // MutexLocker destructor not called when throwing.
ThrowPRException("Failed NSS_Init call.");
}
+ library_initialized_ = true;
status = NSS_SetDomesticPolicy();
if (status != SECSuccess) {
+ mutex_.Unlock(); // MutexLocker destructor not called when throwing.
ThrowPRException("Failed NSS_SetDomesticPolicy call.");
}
// Enable TLS, as well as SSL3 and SSL2.
status = SSL_OptionSetDefault(SSL_ENABLE_TLS, PR_TRUE);
if (status != SECSuccess) {
+ mutex_.Unlock(); // MutexLocker destructor not called when throwing.
ThrowPRException("Failed SSL_OptionSetDefault enable TLS call.");
}
status = SSL_ConfigServerSessionIDCache(0, 0, 0, NULL);
if (status != SECSuccess) {
+ mutex_.Unlock(); // MutexLocker destructor not called when throwing.
ThrowPRException("Failed SSL_ConfigServerSessionIDCache call.");
}
« no previous file with comments | « no previous file | tests/standalone/io/secure_socket_argument_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698