summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Host.cpp
diff options
context:
space:
mode:
authorKristina Brooks <kristina@nym.hush.com>2018-09-04 10:54:09 +0000
committerKristina Brooks <kristina@nym.hush.com>2018-09-04 10:54:09 +0000
commit51ae9346dbb710dfdaf482351b75d2bda903c0a6 (patch)
tree37ce6c1c53697da4e6e5b951b0c89dbecfd561b1 /llvm/lib/Support/Host.cpp
parent8d8489f513a7b777eeb55850d9a1487bf9a1bf1c (diff)
downloadbcm5719-llvm-51ae9346dbb710dfdaf482351b75d2bda903c0a6.tar.gz
bcm5719-llvm-51ae9346dbb710dfdaf482351b75d2bda903c0a6.zip
Do not leak the Mach host port in sys::getHostCPUName()
Patch by rsesek (Robert Sesek) llvm-svn: 341357
Diffstat (limited to 'llvm/lib/Support/Host.cpp')
-rw-r--r--llvm/lib/Support/Host.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index 2c718dd3f5a..d04f6e761ee 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -1022,8 +1022,10 @@ StringRef sys::getHostCPUName() {
mach_msg_type_number_t infoCount;
infoCount = HOST_BASIC_INFO_COUNT;
- host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo,
+ mach_port_t hostPort = mach_host_self();
+ host_info(hostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo,
&infoCount);
+ mach_port_deallocate(mach_task_self(), hostPort);
if (hostInfo.cpu_type != CPU_TYPE_POWERPC)
return "generic";
OpenPOWER on IntegriCloud