Index: ipc/ipc_message_utils.cc |
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc |
index ea88b55a2a5129260bdc984b35e97ee0171b9ad5..277c2ff75c73c8f391d4dae3732d33a4e6478ace 100644 |
--- a/ipc/ipc_message_utils.cc |
+++ b/ipc/ipc_message_utils.cc |
@@ -665,6 +665,11 @@ void ParamTraits<base::SharedMemoryHandle>::Write(Message* m, |
if (p.NeedsBrokering()) { |
HandleWin handle_win(p.GetHandle(), HandleWin::DUPLICATE); |
ParamTraits<HandleWin>::Write(m, handle_win); |
+ |
+ // If the caller intended to pass ownership to the IPC stack, release a |
+ // reference. |
+ if (p.OwnershipPassesToIPC()) |
+ p.Close(); |
} else { |
m->WriteInt(HandleToLong(p.GetHandle())); |
} |