Merge pull request #12103 from samuele3hu/v3_http_leak

Fix the memory leak of HttpClient on the iOS/Mac platform.
This commit is contained in:
子龙山人 2015-06-02 10:11:03 +08:00
commit 40ea6e3e41
2 changed files with 6 additions and 4 deletions

View File

@ -51,10 +51,10 @@
[sslFile release]; [sslFile release];
[responseHeader release]; [responseHeader release];
[responseData release]; [responseData release];
[statusString release];
[responseError release]; [responseError release];
[conn release]; [conn release];
[runLoop release]; [runLoop release];
[connError release];
[super dealloc]; [super dealloc];
} }
@ -178,10 +178,12 @@
{ {
CFDataRef errDataRef = SecTrustCopyExceptions(serverTrust); CFDataRef errDataRef = SecTrustCopyExceptions(serverTrust);
SecTrustSetExceptions(serverTrust, errDataRef); SecTrustSetExceptions(serverTrust, errDataRef);
SecTrustEvaluate(serverTrust, &trustResult); SecTrustEvaluate(serverTrust, &trustResult);
[(id)errDataRef release];
} }
[certData release];
[(id)certArrayRef release];
[(id)certArrayRef release];
//Did our custom trust chain evaluate successfully? //Did our custom trust chain evaluate successfully?
return trustResult = kSecTrustResultUnspecified || trustResult == kSecTrustResultProceed; return trustResult = kSecTrustResultUnspecified || trustResult == kSecTrustResultProceed;
} }

View File

@ -217,7 +217,7 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque
long len = sslCaFileName.length(); long len = sslCaFileName.length();
long pos = sslCaFileName.rfind('.', len-1); long pos = sslCaFileName.rfind('.', len-1);
httpAsynConn.sslFile = [NSString stringWithUTF8String:sslCaFileName.substr(0, pos-1).c_str()]; httpAsynConn.sslFile = [NSString stringWithUTF8String:sslCaFileName.substr(0, pos).c_str()];
} }
[httpAsynConn startRequest:nsrequest]; [httpAsynConn startRequest:nsrequest];