Index: base/mac/scoped_mach_port.cc |
diff --git a/base/mac/scoped_mach_port.cc b/base/mac/scoped_mach_port.cc |
index 652e3f44852161b4f69e0754855b1de93451e2c6..9e45a856a8cf8b38662def3c761f8e05743c17d5 100644 |
--- a/base/mac/scoped_mach_port.cc |
+++ b/base/mac/scoped_mach_port.cc |
@@ -11,9 +11,14 @@ ScopedMachPort::ScopedMachPort(mach_port_t port) : port_(port) { |
} |
ScopedMachPort::~ScopedMachPort() { |
+ reset(); |
+} |
+ |
+void ScopedMachPort::reset(mach_port_t port) { |
if (port_ != MACH_PORT_NULL) { |
mach_port_deallocate(mach_task_self(), port_); |
} |
+ port_ = port; |
} |
} // namespace mac |