[Mac] CFError leak under Objective-C garbage collection
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2013 18:42:49 +0000 (18:42 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2013 18:42:49 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115862

Reviewed by Benjamin Poulain.

* platform/network/mac/ResourceErrorMac.mm:
(WebCore::ResourceError::nsError): Use adoptCF instead of adoptNS since
the CFError needs a CFRelease, not an -[NSObject release].

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149828 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/mac/ResourceErrorMac.mm

index 928b2d0..13d7308 100644 (file)
@@ -1,3 +1,14 @@
+2013-05-09  Darin Adler  <darin@apple.com>
+
+        [Mac] CFError leak under Objective-C garbage collection
+        https://bugs.webkit.org/show_bug.cgi?id=115862
+
+        Reviewed by Benjamin Poulain.
+
+        * platform/network/mac/ResourceErrorMac.mm:
+        (WebCore::ResourceError::nsError): Use adoptCF instead of adoptNS since
+        the CFError needs a CFRelease, not an -[NSObject release].
+
 2013-05-09  Alberto Garcia  <agarcia@igalia.com>
 
         BlackBerry: fix call to PluginLayerWebKitThread::setHolePunchRect()
index cfbaed5..83315b0 100644 (file)
@@ -76,8 +76,8 @@ NSError *ResourceError::nsError() const
 
     if (m_platformError) {
         CFErrorRef error = m_platformError.get();
-        RetainPtr<NSDictionary> userInfo = adoptNS((NSDictionary *) CFErrorCopyUserInfo(error));
-        m_platformNSError = adoptNS([[NSError alloc] initWithDomain:(NSString *)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:userInfo.get()]);
+        RetainPtr<CFDictionaryRef> userInfo = adoptCF(CFErrorCopyUserInfo(error));
+        m_platformNSError = adoptNS([[NSError alloc] initWithDomain:(NSString *)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:(NSDictionary *)userInfo.get()]);
         return m_platformNSError.get();
     }