diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 17:46:31 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 17:46:31 +0000 |
commit | b0af04c4b7595afcfcfe847e232bc6ae88101735 (patch) | |
tree | 9218ad9ed34635f3387dbbe7aca25a55e851e690 /base/shared_memory_posix.cc | |
parent | f4c6499a37788cd2bc2c4781f005ad2c03fd47e7 (diff) | |
download | chromium_src-b0af04c4b7595afcfcfe847e232bc6ae88101735.zip chromium_src-b0af04c4b7595afcfcfe847e232bc6ae88101735.tar.gz chromium_src-b0af04c4b7595afcfcfe847e232bc6ae88101735.tar.bz2 |
Fix a memory leak in ResourceDispatcher
When we delete a ResourceLoaderBridge before OnCompletedRequest is received, bad things happen. There's a lot of leaks at the following points:
1. OnMessageReceived ignores the message.
2. RemovePendingRequest removes it's internal deferred_message_queue.
But ViewHostMsg_Resource_DataReceived is not POD. We should also close the shared memory handle inside it.
Review URL: http://codereview.chromium.org/115396
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 2f0fe22..fe4b225 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -70,6 +70,12 @@ SharedMemoryHandle SharedMemory::NULLHandle() { return SharedMemoryHandle(); } +// static +void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { + DCHECK(handle.fd >= 0); + close(handle.fd); +} + bool SharedMemory::Create(const std::wstring &name, bool read_only, bool open_existing, size_t size) { read_only_ = read_only; |