Title: [233609] trunk/Source/ThirdParty/libwebrtc
Revision
233609
Author
[email protected]
Date
2018-07-06 17:48:04 -0700 (Fri, 06 Jul 2018)

Log Message

libWebRTC GetThreadCpuTimeNanos() leaks mach_ports
https://bugs.webkit.org/show_bug.cgi?id=187403
<rdar://problem/41741599>

Reviewed by Simon Fraser.

* Source/webrtc/rtc_base/cpu_time.cc: Call mach_port_deallocate to
to ensure mach_port is deleted.
* libwebrtc.xcodeproj/project.pbxproj: Stop compiling this file since
this is not used except by libwebrtc tests.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (233608 => 233609)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-07-07 00:44:29 UTC (rev 233608)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-07-07 00:48:04 UTC (rev 233609)
@@ -1,3 +1,16 @@
+2018-07-06  Youenn Fablet  <[email protected]>
+
+        libWebRTC GetThreadCpuTimeNanos() leaks mach_ports
+        https://bugs.webkit.org/show_bug.cgi?id=187403
+        <rdar://problem/41741599>
+
+        Reviewed by Simon Fraser.
+
+        * Source/webrtc/rtc_base/cpu_time.cc: Call mach_port_deallocate to
+        to ensure mach_port is deleted.
+        * libwebrtc.xcodeproj/project.pbxproj: Stop compiling this file since
+        this is not used except by libwebrtc tests.
+
 2018-07-04  Thibault Saunier  <[email protected]>
 
         [libwebrtc] Allow IP mismatch for local connections on localhost

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/cpu_time.cc (233608 => 233609)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/cpu_time.cc	2018-07-07 00:44:29 UTC (rev 233608)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/cpu_time.cc	2018-07-07 00:48:04 UTC (rev 233609)
@@ -18,9 +18,9 @@
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/times.h>
+#include <mach/thread_act.h>
 #include <mach/thread_info.h>
-#include <mach/thread_act.h>
-#include <mach/mach_init.h>
+#include <mach/mach_port.h>
 #include <unistd.h>
 #elif defined(WEBRTC_WIN)
 #include <windows.h>
@@ -83,8 +83,10 @@
 #elif defined(WEBRTC_MAC)
   thread_basic_info_data_t info;
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
-  if (thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)&info,
-                  &count) == KERN_SUCCESS) {
+  auto port = mach_thread_self();
+  auto result = thread_info(port, THREAD_BASIC_INFO, (thread_info_t)&info, &count);
+  mach_port_deallocate(mach_task_self(), port);
+  if (result == KERN_SUCCESS) {
     return info.user_time.seconds * kNumNanosecsPerSec +
            info.user_time.microseconds * kNumNanosecsPerMicrosec;
   } else {

Modified: trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj (233608 => 233609)


--- trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj	2018-07-07 00:44:29 UTC (rev 233608)
+++ trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj	2018-07-07 00:48:04 UTC (rev 233609)
@@ -138,7 +138,6 @@
 		413A23071FE18E0700373E99 /* httpbase.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413A21B21FE18D9700373E99 /* httpbase.cc */; };
 		413A23091FE18E0700373E99 /* memory_usage.h in Headers */ = {isa = PBXBuildFile; fileRef = 413A21B41FE18D9700373E99 /* memory_usage.h */; };
 		413A230A1FE18E0700373E99 /* ptr_util.h in Headers */ = {isa = PBXBuildFile; fileRef = 413A21B51FE18D9800373E99 /* ptr_util.h */; };
-		413A230C1FE18E0700373E99 /* cpu_time.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413A21B81FE18D9900373E99 /* cpu_time.cc */; };
 		413A230D1FE18E0700373E99 /* rate_statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 413A21B91FE18D9A00373E99 /* rate_statistics.h */; };
 		413A230F1FE18E0700373E99 /* rtccertificate.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413A21BB1FE18D9B00373E99 /* rtccertificate.cc */; };
 		413A23101FE18E0700373E99 /* fakeclock.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413A21BC1FE18D9B00373E99 /* fakeclock.cc */; };
@@ -12987,7 +12986,6 @@
 				5CDD907A1E43D15C00621E92 /* covariance_matrix_generator.cc in Sources */,
 				5C4B4CCA1E4320A9002651C8 /* cpu_features.cc in Sources */,
 				5C4B4CCB1E4320A9002651C8 /* cpu_info.cc in Sources */,
-				413A230C1FE18E0700373E99 /* cpu_time.cc in Sources */,
 				5CDD87B11E43BC0500621E92 /* crc.c in Sources */,
 				413A23431FE18E0700373E99 /* crc32.cc in Sources */,
 				5CDD8B8B1E43C2B500621E92 /* create_augmented_vec.c in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to