Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
Fixed two CF memory leaks. (Fixes issue #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Apr 28, 2009
1 parent 0eb23c1 commit 335b9d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions BLIP/BLIPTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static SecIdentityRef ChooseIdentity( NSString *prompt ) {
SecIdentityRef identity;
while (SecIdentitySearchCopyNext(search, &identity) == noErr)
[identities addObject: (id)identity];
CFRelease(search);
Log(@"Found %u identities -- prompting '%@'", identities.count, prompt);
if (identities.count > 0) {
SFChooseIdentityPanel *panel = [SFChooseIdentityPanel sharedChooseIdentityPanel];
Expand Down
6 changes: 4 additions & 2 deletions TCP/TCPConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ - (id) initIncomingFromSocket: (CFSocketNativeHandle)socket
CFWriteStreamRef writeStream = NULL;
CFStreamCreatePairWithSocket(kCFAllocatorDefault, socket, &readStream, &writeStream);
self = [self _initWithAddress: [IPAddress addressOfSocket: socket]
inputStream: (NSInputStream*)readStream
outputStream: (NSOutputStream*)writeStream];
inputStream: (NSInputStream*)CFMakeCollectable(readStream)
outputStream: (NSOutputStream*)CFMakeCollectable(writeStream)];
if( self ) {
_isIncoming = YES;
_server = [listener retain];
CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
}
if(readStream) CFRelease(readStream);
if(writeStream) CFRelease(writeStream);
return self;
}

Expand Down

0 comments on commit 335b9d1

Please sign in to comment.