Changeset 218678 in webkit


Ignore:
Timestamp:
Jun 21, 2017 9:46:42 PM (7 years ago)
Author:
ddkilzer@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r218676 r218678  
     12017-06-21  David Kilzer  <ddkilzer@apple.com>
     2
     3        REGRESSION (r218419): 3 NSMutableDiciontary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
     4        <https://webkit.org/b/173689>
     5
     6        Reviewed by Chris Dumez.
     7
     8        Caught by the clang static analyzer.
     9
     10        * UIProcess/API/Cocoa/WKProcessPool.mm:
     11        (policiesHashMapToDictionary): Switch from using
     12        [[NSMutableDictionary alloc] init] which returns a +1 retained
     13        object in MRR to [NSMutableDictionary new] which returns an
     14        autoreleased object under MRR.  This bug caused 3 leaks when
     15        calling -[WKProcessPool _pluginLoadClientPolicies], which should
     16        return an autoreleased object based on its signature.
     17
    1182017-06-21  Ryosuke Niwa  <rniwa@webkit.org>
    219
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm

    r218419 r218678  
    314314static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>& map)
    315315{
    316     NSMutableDictionary *policies = [[NSMutableDictionary alloc] init];
     316    NSMutableDictionary *policies = [NSMutableDictionary new];
    317317    for (auto& hostPair : map) {
    318318        NSString *host = hostPair.key;
    319         policies[host] = [[NSMutableDictionary alloc] init];
     319        policies[host] = [NSMutableDictionary new];
    320320        for (auto& bundleIdentifierPair : hostPair.value) {
    321321            NSString *bundlerIdentifier = bundleIdentifierPair.key;
    322             policies[host][bundlerIdentifier] = [[NSMutableDictionary alloc] init];
     322            policies[host][bundlerIdentifier] = [NSMutableDictionary new];
    323323            for (auto& versionPair : bundleIdentifierPair.value) {
    324324                NSString *version = versionPair.key;
Note: See TracChangeset for help on using the changeset viewer.