Index: components/password_manager/core/browser/login_database.cc |
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc |
index 0f75ce15a0f6e9bcb6432753ccc68f7d034cb4b0..b10ae514d205c67a6a783038ff2125b2e7426de6 100644 |
--- a/components/password_manager/core/browser/login_database.cc |
+++ b/components/password_manager/core/browser/login_database.cc |
@@ -531,6 +531,7 @@ bool LoginDatabase::Init() { |
if (!transaction.Begin()) { |
LogDatabaseInitError(START_TRANSACTION_ERROR); |
LOG(ERROR) << "Unable to start a transaction."; |
+ transaction.Rollback(); |
vasilii
2016/08/22 14:31:54
If it didn't begin there is nothing to rollback. T
vabr (Chromium)
2016/08/22 14:39:48
Done.
|
db_.Close(); |
return false; |
} |
@@ -540,6 +541,7 @@ bool LoginDatabase::Init() { |
kCompatibleVersionNumber)) { |
LogDatabaseInitError(META_TABLE_INIT_ERROR); |
LOG(ERROR) << "Unable to create the meta table."; |
+ transaction.Rollback(); |
db_.Close(); |
return false; |
} |
@@ -548,6 +550,7 @@ bool LoginDatabase::Init() { |
LOG(ERROR) << "Password store database is too new, kCurrentVersionNumber=" |
<< kCurrentVersionNumber << ", GetCompatibleVersionNumber=" |
<< meta_table_.GetCompatibleVersionNumber(); |
+ transaction.Rollback(); |
db_.Close(); |
return false; |
} |
@@ -559,6 +562,7 @@ bool LoginDatabase::Init() { |
if (!db_.DoesTableExist("logins")) { |
if (!builder.CreateTable(&db_)) { |
VLOG(0) << "Failed to create the 'logins' table"; |
+ transaction.Rollback(); |
db_.Close(); |
return false; |
} |
@@ -588,6 +592,7 @@ bool LoginDatabase::Init() { |
LOG(ERROR) << "Unable to migrate database from " |
<< meta_table_.GetVersionNumber() << " to " |
<< kCurrentVersionNumber; |
+ transaction.Rollback(); |
db_.Close(); |
return false; |
} |
@@ -595,6 +600,7 @@ bool LoginDatabase::Init() { |
if (!stats_table_.CreateTableIfNecessary()) { |
LogDatabaseInitError(INIT_STATS_ERROR); |
LOG(ERROR) << "Unable to create the stats table."; |
+ transaction.Rollback(); |
db_.Close(); |
return false; |
} |
@@ -602,6 +608,7 @@ bool LoginDatabase::Init() { |
if (!transaction.Commit()) { |
LogDatabaseInitError(COMMIT_TRANSACTION_ERROR); |
LOG(ERROR) << "Unable to commit a transaction."; |
+ transaction.Rollback(); |
vasilii
2016/08/22 14:31:54
That's a bug to call Rollback() after Commit().
vabr (Chromium)
2016/08/22 14:39:48
Done.
|
db_.Close(); |
return false; |
} |