From b0af04c4b7595afcfcfe847e232bc6ae88101735 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Mon, 18 May 2009 17:46:31 +0000 Subject: 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 --- base/shared_memory_win.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'base/shared_memory_win.cc') diff --git a/base/shared_memory_win.cc b/base/shared_memory_win.cc index 66f8fb6..dd4c73b 100644 --- a/base/shared_memory_win.cc +++ b/base/shared_memory_win.cc @@ -55,6 +55,12 @@ SharedMemoryHandle SharedMemory::NULLHandle() { return NULL; } +// static +void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { + DCHECK(handle != NULL); + ::CloseHandle(handle); +} + bool SharedMemory::Create(const std::wstring &name, bool read_only, bool open_existing, size_t size) { DCHECK(mapped_file_ == NULL); -- cgit v1.1