Index: base/shared_memory_posix.cc |
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc |
index 7a238ed880b12a641b7461fc01285b7d169d9cc2..42aef2f33b872c52479249e8d1ab2863714a28dd 100644 |
--- a/base/shared_memory_posix.cc |
+++ b/base/shared_memory_posix.cc |
@@ -142,14 +142,20 @@ bool SharedMemory::CreateNamed(const std::string& name, |
if (fp && fix_size) { |
// Get current size. |
struct stat stat; |
- if (fstat(fileno(fp), &stat) != 0) |
+ if (fstat(fileno(fp), &stat) != 0) { |
+ file_util::CloseFile(fp); |
rvargas (doing something else)
2011/06/23 03:43:53
nit: it seems ScopedFILE could be used by this met
|
return false; |
+ } |
const uint32 current_size = stat.st_size; |
if (current_size != size) { |
- if (HANDLE_EINTR(ftruncate(fileno(fp), size)) != 0) |
+ if (HANDLE_EINTR(ftruncate(fileno(fp), size)) != 0) { |
+ file_util::CloseFile(fp); |
return false; |
- if (fseeko(fp, size, SEEK_SET) != 0) |
+ } |
+ if (fseeko(fp, size, SEEK_SET) != 0) { |
+ file_util::CloseFile(fp); |
return false; |
+ } |
} |
created_size_ = size; |
} |