Skip to content

Commit

Permalink
Fix pinnedServerCertificate not getting retained
Browse files Browse the repository at this point in the history
CBLReplicatorConfiguration.pinnedServerCertificate is Core Foundation type so explicitly retaining and releasing are required.
  • Loading branch information
pasin committed Oct 20, 2018
1 parent 7285693 commit 0e4aaf2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Objective-C/CBLReplicatorConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ - (void) setAuthenticator: (CBLAuthenticator *)authenticator {

- (void) setPinnedServerCertificate: (SecCertificateRef)pinnedServerCertificate {
[self checkReadonly];
_pinnedServerCertificate = pinnedServerCertificate;
if (_pinnedServerCertificate != pinnedServerCertificate) {
cfrelease(_pinnedServerCertificate);
_pinnedServerCertificate = pinnedServerCertificate;
cfretain(_pinnedServerCertificate);
}
}


Expand Down Expand Up @@ -187,4 +191,9 @@ - (NSDictionary*) effectiveOptions {
}


- (void) dealloc {
cfrelease(_pinnedServerCertificate);
}


@end

0 comments on commit 0e4aaf2

Please sign in to comment.