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

Unified Diff: net/disk_cache/memory/mem_entry_impl.cc

Issue 1725363005: Fix use after free in memory only backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shorter2
Patch Set: remediate Created 4 years, 10 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
« net/disk_cache/backend_unittest.cc ('K') | « net/disk_cache/backend_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/memory/mem_entry_impl.cc
diff --git a/net/disk_cache/memory/mem_entry_impl.cc b/net/disk_cache/memory/mem_entry_impl.cc
index c28a7fab748d565877004f12331eb6db71efbfb4..bcbebb3cf2f8b7992a307489f828fc5d3025c763 100644
--- a/net/disk_cache/memory/mem_entry_impl.cc
+++ b/net/disk_cache/memory/mem_entry_impl.cc
@@ -103,16 +103,10 @@ void MemEntryImpl::Open() {
}
bool MemEntryImpl::InUse() const {
- if (type() == PARENT_ENTRY) {
- return ref_count_ > 0;
- } else {
- // TODO(gavinp): Can't this just be a DCHECK? How would ref_count_ not be
- // zero?
+ if (type() == CHILD_ENTRY)
+ return parent_->InUse();
- // A child entry is never in use. Thus one can always be evicted, even while
- // its parent entry is open and in use.
- return false;
- }
+ return ref_count_ > 0;
}
int MemEntryImpl::GetStorageSize() const {
« net/disk_cache/backend_unittest.cc ('K') | « net/disk_cache/backend_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698