Title: [218678] trunk/Source/WebKit2
Revision
218678
Author
[email protected]
Date
2017-06-21 21:46:42 -0700 (Wed, 21 Jun 2017)

Log Message

REGRESSION (r218419): 3 NSMutableDiciontary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
<https://webkit.org/b/173689>

Reviewed by Chris Dumez.

Caught by the clang static analyzer.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(policiesHashMapToDictionary): Switch from using
[[NSMutableDictionary alloc] init] which returns a +1 retained
object in MRR to [NSMutableDictionary new] which returns an
autoreleased object under MRR.  This bug caused 3 leaks when
calling -[WKProcessPool _pluginLoadClientPolicies], which should
return an autoreleased object based on its signature.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (218677 => 218678)


--- trunk/Source/WebKit2/ChangeLog	2017-06-22 04:31:12 UTC (rev 218677)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-22 04:46:42 UTC (rev 218678)
@@ -1,3 +1,20 @@
+2017-06-21  David Kilzer  <[email protected]>
+
+        REGRESSION (r218419): 3 NSMutableDiciontary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
+        <https://webkit.org/b/173689>
+
+        Reviewed by Chris Dumez.
+
+        Caught by the clang static analyzer.
+
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (policiesHashMapToDictionary): Switch from using
+        [[NSMutableDictionary alloc] init] which returns a +1 retained
+        object in MRR to [NSMutableDictionary new] which returns an
+        autoreleased object under MRR.  This bug caused 3 leaks when
+        calling -[WKProcessPool _pluginLoadClientPolicies], which should
+        return an autoreleased object based on its signature.
+
 2017-06-21  Ryosuke Niwa  <[email protected]>
 
         Add release assertions help diagnose a hang in CallbackMap

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (218677 => 218678)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2017-06-22 04:31:12 UTC (rev 218677)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2017-06-22 04:46:42 UTC (rev 218678)
@@ -313,13 +313,13 @@
 
 static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>& map)
 {
-    NSMutableDictionary *policies = [[NSMutableDictionary alloc] init];
+    NSMutableDictionary *policies = [NSMutableDictionary new];
     for (auto& hostPair : map) {
         NSString *host = hostPair.key;
-        policies[host] = [[NSMutableDictionary alloc] init];
+        policies[host] = [NSMutableDictionary new];
         for (auto& bundleIdentifierPair : hostPair.value) {
             NSString *bundlerIdentifier = bundleIdentifierPair.key;
-            policies[host][bundlerIdentifier] = [[NSMutableDictionary alloc] init];
+            policies[host][bundlerIdentifier] = [NSMutableDictionary new];
             for (auto& versionPair : bundleIdentifierPair.value) {
                 NSString *version = versionPair.key;
                 policies[host][bundlerIdentifier][version] = [NSNumber numberWithUnsignedInt:versionPair.value];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to