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

Unified Diff: net/disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc

Issue 2404823002: Fix error handling in POSIX version of the base::File::GetLength. (Closed)
Patch Set: Fix error handling in POSIX version of the base::File::GetLength. Created 4 years, 1 month 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: net/disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc
diff --git a/net/disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc b/net/disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc
index 3936358236dd37d787ff9396fd6fc2e218da7b91..a3a4556da8101d178313d11861c02515d81eb047 100644
--- a/net/disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc
+++ b/net/disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc
@@ -16,8 +16,11 @@ void* MappedFile::Init(const base::FilePath& name, size_t size) {
if (init_ || !File::Init(name))
return NULL;
- if (!size)
+ if (!size) {
size = GetLength();
+ if (!size)
+ return NULL;
danakj 2016/11/29 01:48:01 0 should be okay again for this CL
+ }
buffer_ = malloc(size);
snapshot_ = malloc(size);

Powered by Google App Engine
This is Rietveld 408576698