Changeset 180982 in webkit


Ignore:
Timestamp:
Mar 3, 2015 6:51:16 PM (9 years ago)
Author:
Chris Dumez
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:]):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r180967 r180982  
     12015-03-03  Chris Dumez  <cdumez@apple.com>
     2
     3        [WK2] Fix memory leak in _getCookieHeadersForTask
     4        https://bugs.webkit.org/show_bug.cgi?id=142245
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Fix memory leak in _getCookieHeadersForTask. We are leaking the CFDictionary
     9        returned by webKitCookieStorageCopyRequestHeaderFieldsForURL().
     10
     11        This patch addresses the issue by storing the return CFDictionary in a
     12        RetainPtr<CFDictionaryRef>.
     13
     14        * Shared/mac/CookieStorageShim.mm:
     15        (-[WKNSURLSessionLocal _getCookieHeadersForTask:completionHandler:]):
     16
    1172015-03-03  Enrica Casucci  <enrica@apple.com>
    218
  • trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm

    r179409 r180982  
    120120    RetainPtr<NSURLSessionTask> strongTask = task;
    121121    CompletionHandlerBlock completionHandlerCopy = [completionHandler copy];
    122     RunLoop::main().dispatch([strongTask, completionHandlerCopy]{
    123         completionHandlerCopy(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL(nullptr, (CFURLRef)[[strongTask currentRequest] URL]));
     122    RunLoop::main().dispatch([strongTask, completionHandlerCopy] {
     123        RetainPtr<CFDictionaryRef> headers = adoptCF(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL(nullptr, (CFURLRef)[[strongTask currentRequest] URL]));
     124        completionHandlerCopy(headers.get());
    124125        [completionHandlerCopy release];
    125126    });
Note: See TracChangeset for help on using the changeset viewer.