diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 20:17:58 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 20:17:58 +0000 |
commit | 431d0a145888ee2ff1cf4aff277e78fd36924f6b (patch) | |
tree | 8f491756731bf54e280da47ae05e8c8ec69d14d3 /base/sys_info_mac.cc | |
parent | 6361c61b55261a9d3b43c9991e1811ce01a89714 (diff) | |
download | chromium_src-431d0a145888ee2ff1cf4aff277e78fd36924f6b.zip chromium_src-431d0a145888ee2ff1cf4aff277e78fd36924f6b.tar.gz chromium_src-431d0a145888ee2ff1cf4aff277e78fd36924f6b.tar.bz2 |
Fix some potential Mach port leaks from mach_host_self using a new ScopedMachPort class.
BUG=119379
TEST=none
Review URL: https://chromiumcodereview.appspot.com/11188003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sys_info_mac.cc')
-rw-r--r-- | base/sys_info_mac.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc index 3a93689..8ed0290 100644 --- a/base/sys_info_mac.cc +++ b/base/sys_info_mac.cc @@ -12,6 +12,7 @@ #include <sys/types.h> #include "base/logging.h" +#include "base/mac/scoped_mach_port.h" #include "base/stringprintf.h" namespace base { @@ -44,7 +45,8 @@ void SysInfo::OperatingSystemVersionNumbers(int32* major_version, int64 SysInfo::AmountOfPhysicalMemory() { struct host_basic_info hostinfo; mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; - int result = host_info(mach_host_self(), + base::mac::ScopedMachPort host(mach_host_self()); + int result = host_info(host, HOST_BASIC_INFO, reinterpret_cast<host_info_t>(&hostinfo), &count); |