summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-13 21:25:50 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-13 21:25:50 +0000
commitee78622d379d270a3850cca3a4a0132e2a687f74 (patch)
tree069013535212cabc314eb21460fb45351bd32285
parent9b167cf9f2a2ae2ba555969e474c8b59c13c23b4 (diff)
downloadchromium_src-ee78622d379d270a3850cca3a4a0132e2a687f74.zip
chromium_src-ee78622d379d270a3850cca3a4a0132e2a687f74.tar.gz
chromium_src-ee78622d379d270a3850cca3a4a0132e2a687f74.tar.bz2
Fix a memory leak when closing an IPC channel and not properly
removing the registration with the IO pump. TBR=darin Review URL: http://codereview.chromium.org/7122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3316 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/ipc_channel.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/common/ipc_channel.cc b/chrome/common/ipc_channel.cc
index 8c0612e..a9d73e7 100644
--- a/chrome/common/ipc_channel.cc
+++ b/chrome/common/ipc_channel.cc
@@ -52,8 +52,15 @@ Channel::Channel(const wstring& channel_id, Mode mode, Listener* listener)
void Channel::Close() {
// make sure we are no longer watching the pipe events
MessageLoopForIO* loop = MessageLoopForIO::current();
- loop->WatchObject(input_state_.overlapped.hEvent, NULL);
- loop->WatchObject(output_state_.overlapped.hEvent, NULL);
+ if (input_state_.is_pending) {
+ input_state_.is_pending = false;
+ loop->RegisterIOContext(&input_state_.overlapped, NULL);
+ }
+
+ if (output_state_.is_pending) {
+ output_state_.is_pending = false;
+ loop->RegisterIOContext(&output_state_.overlapped, NULL);
+ }
if (pipe_ != INVALID_HANDLE_VALUE) {
CloseHandle(pipe_);