Index: mojo/public/cpp/bindings/lib/connector.cc |
diff --git a/mojo/public/cpp/bindings/lib/connector.cc b/mojo/public/cpp/bindings/lib/connector.cc |
index 938cdc99706eeee396161fcfde7c2ab4a593ee21..1d25640c0a5006840778e5d4267867e380101d14 100644 |
--- a/mojo/public/cpp/bindings/lib/connector.cc |
+++ b/mojo/public/cpp/bindings/lib/connector.cc |
@@ -160,11 +160,12 @@ bool Connector::Accept(Message* message) { |
static_cast<uint32_t>(message->mutable_handles()->size()), |
MOJO_WRITE_MESSAGE_FLAG_NONE); |
+ // The handles are always either transferred or closed, so we don't need the |
+ // message to track their lifetime any longer. |
+ message->mutable_handles()->clear(); |
+ |
switch (rv) { |
case MOJO_RESULT_OK: |
- // The handles were successfully transferred, so we don't need the message |
- // to track their lifetime any longer. |
- message->mutable_handles()->clear(); |
break; |
case MOJO_RESULT_FAILED_PRECONDITION: |
// There's no point in continuing to write to this pipe since the other |