[PATCH] D51517: Do not leak the Mach host port in sys::getHostCPUName()
Robert Sesek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 30 15:09:10 PDT 2018
rsesek created this revision.
rsesek added a reviewer: chandlerc.
Herald added a subscriber: llvm-commits.
Patch by: rsesek
Repository:
rL LLVM
https://reviews.llvm.org/D51517
Files:
lib/Support/Host.cpp
Index: lib/Support/Host.cpp
===================================================================
--- lib/Support/Host.cpp
+++ lib/Support/Host.cpp
@@ -1022,8 +1022,10 @@
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";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51517.163425.patch
Type: text/x-patch
Size: 576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180830/391707f8/attachment.bin>
More information about the llvm-commits
mailing list