Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2993)

Unified Diff: base/process_util_mac.mm

Issue 11188003: Fix some potential Mach port leaks from mach_host_self using a new ScopedMachPort class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/process_util_mac.mm
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index 4885e4b18c6135ea08b1311eca24c1b0919ebd88..be17a1d56c0bae2a218c92bbba118bb60a906dcc 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -34,6 +34,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
+#include "base/mac/scoped_mach_port.h"
#include "base/string_util.h"
#include "base/sys_info.h"
#include "base/threading/thread_local.h"
@@ -468,7 +469,7 @@ mach_port_t ProcessMetrics::TaskForPid(ProcessHandle process) const {
// Bytes committed by the system.
size_t GetSystemCommitCharge() {
- host_name_port_t host = mach_host_self();
+ base::mac::ScopedMachPort<host_name_port_t> host(mach_host_self());
mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
vm_statistics_data_t data;
kern_return_t kr = host_statistics(host, HOST_VM_INFO,

Powered by Google App Engine
This is Rietveld 408576698