projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8d8489f
)
Do not leak the Mach host port in sys::getHostCPUName()
author
Kristina Brooks
<kristina@nym.hush.com>
Tue, 4 Sep 2018 10:54:09 +0000
(10:54 +0000)
committer
Kristina Brooks
<kristina@nym.hush.com>
Tue, 4 Sep 2018 10:54:09 +0000
(10:54 +0000)
Patch by rsesek (Robert Sesek)
llvm-svn: 341357
llvm/lib/Support/Host.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Support/Host.cpp
b/llvm/lib/Support/Host.cpp
index
2c718dd
..
d04f6e7
100644
(file)
--- 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";