Title: [92897] trunk/Source/WebCore
Revision
92897
Author
[email protected]
Date
2011-08-11 17:52:28 -0700 (Thu, 11 Aug 2011)

Log Message

<http://webkit.org/b/66113> [CFNetwork] willCacheResponse() leaks CFCachedURLResponseRef if delegate changes CacheStoragePolicy

Reviewed by Joseph Pecoraro.

This first appeared in ToT WebKit r23462 (Windows merge).

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::willCacheResponse): Only retain cachedResponse if we
are returning the same object passed into the method, otherwise
we end up double-retaining the new object created.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92896 => 92897)


--- trunk/Source/WebCore/ChangeLog	2011-08-12 00:45:08 UTC (rev 92896)
+++ trunk/Source/WebCore/ChangeLog	2011-08-12 00:52:28 UTC (rev 92897)
@@ -1,3 +1,16 @@
+2011-08-11  David Kilzer  <[email protected]>
+
+        <http://webkit.org/b/66113> [CFNetwork] willCacheResponse() leaks CFCachedURLResponseRef if delegate changes CacheStoragePolicy
+
+        Reviewed by Joseph Pecoraro.
+
+        This first appeared in ToT WebKit r23462 (Windows merge).
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::willCacheResponse): Only retain cachedResponse if we
+        are returning the same object passed into the method, otherwise
+        we end up double-retaining the new object created.
+
 2011-08-05  Nat Duca  <[email protected]>
 
         [chromium] Make WebViewImpl point at CCLayerTreeHost and related separation

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (92896 => 92897)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2011-08-12 00:45:08 UTC (rev 92896)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2011-08-12 00:52:28 UTC (rev 92897)
@@ -328,13 +328,14 @@
     if (handle->client())
         handle->client()->willCacheResponse(handle, policy);
 
-    if (static_cast<CFURLCacheStoragePolicy>(policy) != CFCachedURLResponseGetStoragePolicy(cachedResponse))
+    if (static_cast<CFURLCacheStoragePolicy>(policy) != CFCachedURLResponseGetStoragePolicy(cachedResponse)) {
         cachedResponse = CFCachedURLResponseCreateWithUserInfo(kCFAllocatorDefault, 
                                                                CFCachedURLResponseGetWrappedResponse(cachedResponse),
                                                                CFCachedURLResponseGetReceiverData(cachedResponse),
                                                                CFCachedURLResponseGetUserInfo(cachedResponse), 
                                                                static_cast<CFURLCacheStoragePolicy>(policy));
-    CFRetain(cachedResponse);
+    } else
+        CFRetain(cachedResponse);
 
     return cachedResponse;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to