diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 20:23:50 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 20:23:50 +0000 |
commit | abbcc2cd73e330df942d3a400c766736a14d3a11 (patch) | |
tree | f4ff82c94223900517c7cd58d12cf874bcb72684 /net | |
parent | f7d8f971d839891709d1173ed1b11738c7235cbf (diff) | |
download | chromium_src-abbcc2cd73e330df942d3a400c766736a14d3a11.zip chromium_src-abbcc2cd73e330df942d3a400c766736a14d3a11.tar.gz chromium_src-abbcc2cd73e330df942d3a400c766736a14d3a11.tar.bz2 |
Fix a browser crash when reading the disk cache experiment data
after failing to map the index file.
BUG=11414
TEST=none
Review URL: http://codereview.chromium.org/100349
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 0a70169..cae361a 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -260,7 +260,7 @@ bool BackendImpl::Init() { } init_ = true; - if (data_ && !InitExperiment(&data_->header.experiment)) + if (!InitExperiment(&data_->header.experiment)) return false; if (data_->header.experiment > 6) @@ -937,6 +937,10 @@ bool BackendImpl::InitBackingStore(bool* file_created) { index_ = new MappedFile(); data_ = reinterpret_cast<Index*>(index_->Init(index_name, 0)); + if (!data_) { + LOG(ERROR) << "Unable to map Index file"; + return false; + } return true; } @@ -1402,10 +1406,7 @@ void BackendImpl::UpgradeTo2_1() { } bool BackendImpl::CheckIndex() { - if (!data_) { - LOG(ERROR) << "Unable to map Index file"; - return false; - } + DCHECK(data_); size_t current_size = index_->GetLength(); if (current_size < sizeof(Index)) { |