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

Unified Diff: components/password_manager/core/browser/login_database.cc

Issue 2265103002: LoginDatabase::Init: rollback before closing a DB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CreateUniqueTempDir Created 4 years, 4 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
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..b7950ad32840c5ce04f7e214d85ca79c43c72b09 100644
--- a/components/password_manager/core/browser/login_database.cc
+++ b/components/password_manager/core/browser/login_database.cc
@@ -540,6 +540,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 +549,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 +561,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 +591,7 @@ bool LoginDatabase::Init() {
LOG(ERROR) << "Unable to migrate database from "
<< meta_table_.GetVersionNumber() << " to "
<< kCurrentVersionNumber;
+ transaction.Rollback();
db_.Close();
return false;
}
@@ -595,6 +599,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;
}

Powered by Google App Engine
This is Rietveld 408576698