Title: [180982] trunk/Source/WebKit2
Revision
180982
Author
cdu...@apple.com
Date
2015-03-03 18:51:16 -0800 (Tue, 03 Mar 2015)

Log Message

[WK2] Fix memory leak in _getCookieHeadersForTask
https://bugs.webkit.org/show_bug.cgi?id=142245

Reviewed by Alexey Proskuryakov.

Fix memory leak in _getCookieHeadersForTask. We are leaking the CFDictionary
returned by webKitCookieStorageCopyRequestHeaderFieldsForURL().

This patch addresses the issue by storing the return CFDictionary in a
RetainPtr<CFDictionaryRef>.

* Shared/mac/CookieStorageShim.mm:
(-[WKNSURLSessionLocal _getCookieHeadersForTask:completionHandler:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (180981 => 180982)


--- trunk/Source/WebKit2/ChangeLog	2015-03-04 02:47:53 UTC (rev 180981)
+++ trunk/Source/WebKit2/ChangeLog	2015-03-04 02:51:16 UTC (rev 180982)
@@ -1,3 +1,19 @@
+2015-03-03  Chris Dumez  <cdu...@apple.com>
+
+        [WK2] Fix memory leak in _getCookieHeadersForTask
+        https://bugs.webkit.org/show_bug.cgi?id=142245
+
+        Reviewed by Alexey Proskuryakov.
+
+        Fix memory leak in _getCookieHeadersForTask. We are leaking the CFDictionary
+        returned by webKitCookieStorageCopyRequestHeaderFieldsForURL().
+
+        This patch addresses the issue by storing the return CFDictionary in a
+        RetainPtr<CFDictionaryRef>.
+
+        * Shared/mac/CookieStorageShim.mm:
+        (-[WKNSURLSessionLocal _getCookieHeadersForTask:completionHandler:]):
+
 2015-03-03  Enrica Casucci  <enr...@apple.com>
 
         Incomplete dictation results in text fields in a web page.

Modified: trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm (180981 => 180982)


--- trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm	2015-03-04 02:47:53 UTC (rev 180981)
+++ trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm	2015-03-04 02:51:16 UTC (rev 180982)
@@ -119,8 +119,9 @@
 
     RetainPtr<NSURLSessionTask> strongTask = task;
     CompletionHandlerBlock completionHandlerCopy = [completionHandler copy];
-    RunLoop::main().dispatch([strongTask, completionHandlerCopy]{
-        completionHandlerCopy(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL(nullptr, (CFURLRef)[[strongTask currentRequest] URL]));
+    RunLoop::main().dispatch([strongTask, completionHandlerCopy] {
+        RetainPtr<CFDictionaryRef> headers = adoptCF(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL(nullptr, (CFURLRef)[[strongTask currentRequest] URL]));
+        completionHandlerCopy(headers.get());
         [completionHandlerCopy release];
     });
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to