summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 17:37:38 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 17:37:38 +0000
commit41eccabc09eca87bfedc1f8c7b70370ec1d3b8b5 (patch)
tree5a5f6b2d871660c44324b9688efd4f71726fbbee /net/disk_cache/backend_impl.cc
parent8b262354e6f28e2f9580f924b5f9cf9d580eb3c2 (diff)
downloadchromium_src-41eccabc09eca87bfedc1f8c7b70370ec1d3b8b5.zip
chromium_src-41eccabc09eca87bfedc1f8c7b70370ec1d3b8b5.tar.gz
chromium_src-41eccabc09eca87bfedc1f8c7b70370ec1d3b8b5.tar.bz2
Disk cache: Make sure that we don't use the address of an
entry before we see if it is valid. BUG=96355 TEST=none Review URL: http://codereview.chromium.org/7875010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r--net/disk_cache/backend_impl.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 3b2a4ca..22cac20 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1532,17 +1532,17 @@ int BackendImpl::NewEntry(Addr address, EntryImpl** entry) {
return 0;
}
- scoped_refptr<EntryImpl> cache_entry(
- new EntryImpl(this, address, read_only_));
- IncreaseNumRefs();
- *entry = NULL;
-
if (!address.is_initialized() || address.is_separate_file() ||
address.file_type() != BLOCK_256) {
LOG(WARNING) << "Wrong entry address.";
return ERR_INVALID_ADDRESS;
}
+ scoped_refptr<EntryImpl> cache_entry(
+ new EntryImpl(this, address, read_only_));
+ IncreaseNumRefs();
+ *entry = NULL;
+
TimeTicks start = TimeTicks::Now();
if (!cache_entry->entry()->Load())
return ERR_READ_FAILURE;