#if ENABLE(CACHE_PARTITIONING) void WebResourceCacheManager::cfURLCacheHostNamesWithCallback(CacheCallback callback) { WKCFURLCacheCopyAllPartitionNames(^(CFArrayRef partitionNames) { CFMutableArrayRef hostNames = CFArrayCreateMutableCopy(0, 0, WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFSTR(""))); CFArrayAppendArray(hostNames, partitionNames, CFRangeMake(0, CFArrayGetCount(partitionNames))); CFRelease(partitionNames); callback(adoptCF(hostNames)); }); } #endif The array returned by the call to WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFSTR("”)) is getting leaked.
Created attachment 206395 [details] Patch
Comment on attachment 206395 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=206395&action=review > Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:68 > + CFMutableArrayRef hostNames = CFArrayCreateMutableCopy(0, 0, hostNamesInPersistentStore.get()); I think you can use a RetainPtr here (with adoptCF). > Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:71 > callback(adoptCF(hostNames)); and then just call std::move(hostNames) here.
(In reply to comment #2) > (From update of attachment 206395 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=206395&action=review > > > Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:68 > > + CFMutableArrayRef hostNames = CFArrayCreateMutableCopy(0, 0, hostNamesInPersistentStore.get()); > > I think you can use a RetainPtr here (with adoptCF). Done. > > > Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:71 > > callback(adoptCF(hostNames)); > > and then just call std::move(hostNames) here. Done. Thanks for the review!
Comment on attachment 206395 [details] Patch Committed in http://trac.webkit.org/changeset/152578