| Index: storage/browser/fileapi/sandbox_directory_database.cc
|
| diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc
|
| index 343f09f5c7a22eb194434c9ed5d765ee8b69f6df..20245d46d7966da2733cf8f64c53601a8258fa60 100644
|
| --- a/storage/browser/fileapi/sandbox_directory_database.cc
|
| +++ b/storage/browser/fileapi/sandbox_directory_database.cc
|
| @@ -844,11 +844,15 @@ void SandboxDirectoryDatabase::ReportInitStatus(
|
|
|
| bool SandboxDirectoryDatabase::StoreDefaultValues() {
|
| // Verify that this is a totally new database, and initialize it.
|
| - scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(leveldb::ReadOptions()));
|
| - iter->SeekToFirst();
|
| - if (iter->Valid()) { // DB was not empty--we shouldn't have been called.
|
| - LOG(ERROR) << "File system origin database is corrupt!";
|
| - return false;
|
| + {
|
| + // Scope the iterator to ensure deleted before database is closed.
|
| + scoped_ptr<leveldb::Iterator> iter(
|
| + db_->NewIterator(leveldb::ReadOptions()));
|
| + iter->SeekToFirst();
|
| + if (iter->Valid()) { // DB was not empty--we shouldn't have been called.
|
| + LOG(ERROR) << "File system origin database is corrupt!";
|
| + return false;
|
| + }
|
| }
|
| // This is always the first write into the database. If we ever add a
|
| // version number, it should go in this transaction too.
|
|
|