WebCore:
authorkmccullo <kmccullo@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Aug 2007 00:18:04 +0000 (00:18 +0000)
committerkmccullo <kmccullo@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Aug 2007 00:18:04 +0000 (00:18 +0000)
        Reviewed by Darin.

        - Use initWithUser instead of credentialWithUser because credentialWithUser leaks.

        * platform/network/mac/AuthenticationMac.mm:
        (WebCore::mac):
        * platform/network/mac/ResourceHandleMac.mm:
        (-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
        (-[WebCoreSynchronousLoader connection:didReceiveAuthenticationChallenge:]):

WebKit:

        Reviewed by Darin.

        - Use initWithUser instead of credentialWithUser because credentialWithUser leaks.

        * Panels/WebAuthenticationPanel.m:
        (-[WebAuthenticationPanel runAsModalDialogWithChallenge:]):
        (-[WebAuthenticationPanel sheetDidEnd:returnCode:contextInfo:]):

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

WebCore/ChangeLog
WebCore/platform/network/mac/AuthenticationMac.mm
WebCore/platform/network/mac/ResourceHandleMac.mm
WebKit/ChangeLog
WebKit/Panels/WebAuthenticationPanel.m

index 3548b241de99870e7a88c08ea0e45960d23e50d8..d8a3f50b728c4c9316f4823e5e469d1305d0f029 100644 (file)
@@ -1,3 +1,15 @@
+2007-08-24  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Darin.
+
+        - Use initWithUser instead of credentialWithUser because credentialWithUser leaks.
+
+        * platform/network/mac/AuthenticationMac.mm:
+        (WebCore::mac):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
+        (-[WebCoreSynchronousLoader connection:didReceiveAuthenticationChallenge:]):
+
 2007-08-24  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Reviewed by Darin.
index a5e293757e2cf5a15a2a447bbbdbe0d012f4f7e0..1555cac0bf1e32bbcd69610ca219e8f493d2e4f8 100644 (file)
@@ -142,10 +142,11 @@ NSURLCredential *mac(const Credential& coreCredential)
         default:
             ASSERT_NOT_REACHED();
     }
-    
-    return [NSURLCredential credentialWithUser:coreCredential.user()
-                                      password:coreCredential.password()
-                                   persistence:persistence];
+
+    return [[[NSURLCredential alloc] initWithUser:coreCredential.user()
+                                        password:coreCredential.password()
+                                     persistence:persistence]
+                                     autorelease];
 }
 
 AuthenticationChallenge core(NSURLAuthenticationChallenge *macChallenge)
index 285b4a8561855236227a9ff57b62b14636879a40..1ea636ed82ed5db659153ff9ed5acd65108fdfd2 100644 (file)
@@ -376,10 +376,11 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
         NSString *password = [m_url password];
 
         if (user && password) {
-            NSURLCredential *credential = [NSURLCredential credentialWithUser:user
+            NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:user
                                                                      password:password
                                                                   persistence:NSURLCredentialPersistenceForSession];
             [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
+            [credential release];
             return;
         }
     }
@@ -537,10 +538,11 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
         NSString *password = [m_url password];
         
         if (user && password) {
-            NSURLCredential *credential = [NSURLCredential credentialWithUser:user
+            NSURLCredential *credential = [[NSURLCredential alloc] initWithUser:user
                                                                      password:password
                                                                   persistence:NSURLCredentialPersistenceForSession];
             [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
+            [credential release];
             return;
         }
     }
index 48f98eda7b2936322247a627a42da123f610d1c1..d557de40010d262a2d54c626645f5f3042089630 100644 (file)
@@ -1,3 +1,13 @@
+2007-08-24  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Darin.
+
+        - Use initWithUser instead of credentialWithUser because credentialWithUser leaks.
+
+        * Panels/WebAuthenticationPanel.m:
+        (-[WebAuthenticationPanel runAsModalDialogWithChallenge:]):
+        (-[WebAuthenticationPanel sheetDidEnd:returnCode:contextInfo:]):
+
 2007-08-24  Adele Peterson  <adele@apple.com>
 
         Fix by Darin, reviewed by Adele.
index abc6d6793fb9e0c1dd7c56fa5d39faabccacafc2..b6904a1d673310470b32c7475b4f71ced7344d18 100644 (file)
     NSURLCredential *credential = nil;
 
     if ([[NSApplication sharedApplication] runModalForWindow:panel] == 0) {
-        credential = [NSURLCredential credentialWithUser:[username stringValue] password:[password stringValue] persistence:([remember state] == NSOnState) ? NSURLCredentialPersistencePermanent : NSURLCredentialPersistenceForSession];
+        credential = [[NSURLCredential alloc] initWithUser:[username stringValue] password:[password stringValue] persistence:([remember state] == NSOnState) ? NSURLCredentialPersistencePermanent : NSURLCredentialPersistenceForSession];
     }
 
     [callback performSelector:selector withObject:chall withObject:credential];
+    [credential release];
 }
 
 - (void)runAsSheetOnWindow:(NSWindow *)window withChallenge:(NSURLAuthenticationChallenge *)chall
     ASSERT(challenge != nil);
 
     if (returnCode == 0) {
-        credential = [NSURLCredential credentialWithUser:[username stringValue] password:[password stringValue] persistence:([remember state] == NSOnState) ? NSURLCredentialPersistencePermanent : NSURLCredentialPersistenceForSession];
+        credential = [[NSURLCredential alloc] initWithUser:[username stringValue] password:[password stringValue] persistence:([remember state] == NSOnState) ? NSURLCredentialPersistencePermanent : NSURLCredentialPersistenceForSession];
     }
 
     // We take this tricky approach to nilling out and releasing the challenge
     chall = challenge;
     challenge = nil;
     [callback performSelector:selector withObject:chall withObject:credential];
+    [credential release];
     [chall release];
 }