Skip to content

Commit c20d814

Browse files
author
Brandon Werner
committed
Merge pull request #187 from AzureAD/dev
Fix leaking timers and other memory issues
2 parents 37cda1a + e194473 commit c20d814

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ADALiOS/ADALiOS/ADAuthenticationWebViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
163163

164164
- (void)webViewDidStartLoad:(UIWebView *)webView
165165
{
166+
167+
if (timer != nil){
168+
[timer invalidate];
169+
}
166170
#pragma unused(webView)
167171
timer = [NSTimer scheduledTimerWithTimeInterval:_timeout target:self selector:@selector(failWithTimeout) userInfo:nil repeats:NO];
168172
}
@@ -171,13 +175,15 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView
171175
{
172176
#pragma unused(webView)
173177
[timer invalidate];
178+
timer = nil;
174179
}
175180

176181
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
177182
{
178183
#pragma unused(webView)
179184
if(timer && [timer isValid]){
180185
[timer invalidate];
186+
timer = nil;
181187
}
182188

183189
if (NSURLErrorCancelled == error.code)

ADALiOS/ADALiOS/ADWorkPlaceJoinUtil.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ - (ADRegistrationInformation*)getRegistrationInformation: (NSString*) sharedAcce
111111
{
112112
AD_LOG_VERBOSE(@"Found identity in keychain", nil);
113113
//Get the certificate and data
114-
status = SecIdentityCopyCertificate(identity, &certificate);
114+
SecIdentityCopyCertificate(identity, &certificate);
115115
if(certificate)
116116
{
117117
AD_LOG_VERBOSE(@"Found certificate in keychain", nil);
@@ -230,6 +230,10 @@ - (NSData *)base64DataFromString: (NSString *)string
230230
return [NSData data];
231231
}
232232

233+
for (int i = 0; i < BASE64QUANTUMREP; i++) {
234+
accumulated[i] = 0;
235+
}
236+
233237
charString = (const unsigned char *)[string UTF8String];
234238

235239
theData = [NSMutableData dataWithCapacity: [string length]];

0 commit comments

Comments
 (0)